1{ lib 2, buildPythonPackage 3, fetchPypi 4, fetchpatch 5, pytestCheckHook 6, numpy 7, libsndfile 8, cffi 9, isPyPy 10, stdenv 11}: 12 13buildPythonPackage rec { 14 pname = "soundfile"; 15 version = "0.10.3.post1"; 16 # https://github.com/bastibe/python-soundfile/issues/157 17 disabled = isPyPy || stdenv.isi686; 18 19 src = fetchPypi { 20 pname = "SoundFile"; 21 inherit version; 22 sha256 = "0yqhrfz7xkvqrwdxdx2ydy4h467sk7z3gf984y1x2cq7cm1gy329"; 23 }; 24 25 patches = [ 26 # Fix build on macOS arm64, https://github.com/bastibe/python-soundfile/pull/332 27 (fetchpatch { 28 url = "https://github.com/bastibe/python-soundfile/commit/e554e9ce8bed96207d587e6aa661e4b08f1c6a79.patch"; 29 sha256 = "sha256-vu/7s5q4I3yBnoNHmmFmcXvOLFcPwY9ri9ri6cKLDwU="; 30 }) 31 ]; 32 33 postPatch = '' 34 substituteInPlace soundfile.py --replace "_find_library('sndfile')" "'${libsndfile.out}/lib/libsndfile${stdenv.hostPlatform.extensions.sharedLibrary}'" 35 ''; 36 37 checkInputs = [ pytestCheckHook ]; 38 propagatedBuildInputs = [ numpy libsndfile cffi ]; 39 propagatedNativeBuildInputs = [ cffi ]; 40 41 # Test fails on aarch64-darwin with `MemoryError`, 53 failed, 31 errors, see 42 # https://github.com/bastibe/python-soundfile/issues/331 43 doCheck = stdenv.system != "aarch64-darwin"; 44 45 meta = { 46 description = "An audio library based on libsndfile, CFFI and NumPy"; 47 license = lib.licenses.bsd3; 48 homepage = "https://github.com/bastibe/python-soundfile"; 49 maintainers = with lib.maintainers; [ fridh ]; 50 }; 51}