1{ lib
2, buildPythonPackage
3, fetchPypi
4, pytestCheckHook
5, numpy
6, libsndfile
7, cffi
8, isPyPy
9, stdenv
10}:
11
12buildPythonPackage rec {
13 pname = "soundfile";
14 version = "0.12.1";
15 # https://github.com/bastibe/python-soundfile/issues/157
16 disabled = isPyPy || stdenv.isi686;
17
18 src = fetchPypi {
19 inherit pname version;
20 hash = "sha256-6OEBeyzx3adnrvGdL9nuXr4H4FDUMPd6Cnxmugi4za4=";
21 };
22
23 patches = [
24 ./0001-Fix-build-on-linux-arm64.patch
25 ];
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 = [ numpy libsndfile cffi ];
33 propagatedNativeBuildInputs = [ cffi ];
34
35 meta = {
36 description = "An audio library based on libsndfile, CFFI and NumPy";
37 license = lib.licenses.bsd3;
38 homepage = "https://github.com/bastibe/python-soundfile";
39 maintainers = with lib.maintainers; [ fridh ];
40 };
41}