2020-04-24 23:36:52 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2022-03-10 19:12:11 +00:00
|
|
|
, fetchpatch
|
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, numpy
|
|
|
|
, libsndfile
|
|
|
|
, cffi
|
|
|
|
, isPyPy
|
|
|
|
, stdenv
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "soundfile";
|
2023-02-09 11:40:11 +00:00
|
|
|
version = "0.11.0";
|
2022-03-10 19:12:11 +00:00
|
|
|
# https://github.com/bastibe/python-soundfile/issues/157
|
|
|
|
disabled = isPyPy || stdenv.isi686;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
2023-02-09 11:40:11 +00:00
|
|
|
inherit pname version;
|
|
|
|
sha256 = "sha256-kxc4ock+hoTC0+HVFKxjRAzoJ+x4PqCi0+RzDj3FjBg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-03-10 19:12:11 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace soundfile.py --replace "_find_library('sndfile')" "'${libsndfile.out}/lib/libsndfile${stdenv.hostPlatform.extensions.sharedLibrary}'"
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2022-03-10 19:12:11 +00:00
|
|
|
propagatedBuildInputs = [ numpy libsndfile cffi ];
|
|
|
|
propagatedNativeBuildInputs = [ cffi ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
preConfigure = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
|
|
|
|
export PYSOUNDFILE_ARCHITECTURE=x86_64
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-10 19:12:11 +00:00
|
|
|
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 ];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
}
|