about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/soundfile/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/soundfile/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/soundfile/default.nix41
1 files changed, 26 insertions, 15 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/soundfile/default.nix b/nixpkgs/pkgs/development/python-modules/soundfile/default.nix
index 9a1d614062b7..c1b68e61088e 100644
--- a/nixpkgs/pkgs/development/python-modules/soundfile/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/soundfile/default.nix
@@ -1,7 +1,8 @@
 { lib
 , buildPythonPackage
 , fetchPypi
-, pytest
+, fetchpatch
+, pytestCheckHook
 , numpy
 , libsndfile
 , cffi
@@ -12,6 +13,8 @@
 buildPythonPackage rec {
   pname = "soundfile";
   version = "0.10.3.post1";
+  # https://github.com/bastibe/python-soundfile/issues/157
+  disabled = isPyPy || stdenv.isi686;
 
   src = fetchPypi {
     pname = "SoundFile";
@@ -19,22 +22,30 @@ buildPythonPackage rec {
     sha256 = "0yqhrfz7xkvqrwdxdx2ydy4h467sk7z3gf984y1x2cq7cm1gy329";
   };
 
-    checkInputs = [ pytest ];
-    propagatedBuildInputs = [ numpy libsndfile cffi ];
-    propagatedNativeBuildInputs = [ cffi ];
+  patches = [
+    # Fix build on macOS arm64, https://github.com/bastibe/python-soundfile/pull/332
+    (fetchpatch {
+      url = "https://github.com/bastibe/python-soundfile/commit/e554e9ce8bed96207d587e6aa661e4b08f1c6a79.patch";
+      sha256 = "sha256-vu/7s5q4I3yBnoNHmmFmcXvOLFcPwY9ri9ri6cKLDwU=";
+    })
+  ];
 
-    meta = {
-      description = "An audio library based on libsndfile, CFFI and NumPy";
-      license = lib.licenses.bsd3;
-      homepage = "https://github.com/bastibe/PySoundFile";
-      maintainers = with lib.maintainers; [ fridh ];
-    };
+  postPatch = ''
+    substituteInPlace soundfile.py --replace "_find_library('sndfile')" "'${libsndfile.out}/lib/libsndfile${stdenv.hostPlatform.extensions.sharedLibrary}'"
+  '';
 
-    postPatch = ''
-      substituteInPlace soundfile.py --replace "_find_library('sndfile')" "'${libsndfile.out}/lib/libsndfile${stdenv.hostPlatform.extensions.sharedLibrary}'"
-    '';
+  checkInputs = [ pytestCheckHook ];
+  propagatedBuildInputs = [ numpy libsndfile cffi ];
+  propagatedNativeBuildInputs = [ cffi ];
 
-    # https://github.com/bastibe/PySoundFile/issues/157
-    disabled = isPyPy ||  stdenv.isi686;
+  # Test fails on aarch64-darwin with `MemoryError`, 53 failed, 31 errors, see
+  # https://github.com/bastibe/python-soundfile/issues/331
+  doCheck = stdenv.system != "aarch64-darwin";
 
+  meta = {
+    description = "An audio library based on libsndfile, CFFI and NumPy";
+    license = lib.licenses.bsd3;
+    homepage = "https://github.com/bastibe/python-soundfile";
+    maintainers = with lib.maintainers; [ fridh ];
+  };
 }