1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 pytestCheckHook,
6 numpy,
7 libsndfile,
8 cffi,
9 isPyPy,
10 stdenv,
11}:
12
13buildPythonPackage rec {
14 pname = "soundfile";
15 version = "0.12.1";
16 format = "setuptools";
17 # https://github.com/bastibe/python-soundfile/issues/157
18 disabled = isPyPy || stdenv.isi686;
19
20 src = fetchPypi {
21 inherit pname version;
22 hash = "sha256-6OEBeyzx3adnrvGdL9nuXr4H4FDUMPd6Cnxmugi4za4=";
23 };
24
25 patches = [ ./0001-Fix-build-on-linux-arm64.patch ];
26
27 postPatch = ''
28 substituteInPlace soundfile.py --replace "_find_library('sndfile')" "'${libsndfile.out}/lib/libsndfile${stdenv.hostPlatform.extensions.sharedLibrary}'"
29 '';
30
31 nativeCheckInputs = [ pytestCheckHook ];
32 propagatedBuildInputs = [
33 numpy
34 libsndfile
35 cffi
36 ];
37 propagatedNativeBuildInputs = [ cffi ];
38
39 meta = {
40 description = "Audio library based on libsndfile, CFFI and NumPy";
41 license = lib.licenses.bsd3;
42 homepage = "https://github.com/bastibe/python-soundfile";
43 };
44}