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