Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / samplerate / default.nix
blob7ac9950a6966888e67e2d93ff8564c8af05f000a
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , fetchFromGitHub
5 , cffi
6 , numpy
7 , libsamplerate
8 , pytestCheckHook
9 }:
11 buildPythonPackage rec {
12   pname = "samplerate";
13   version = "0.1.0";
14   format = "setuptools";
16   src = fetchFromGitHub {
17     owner = "tuxu";
18     repo = "python-samplerate";
19     rev = "refs/tags/${version}";
20     hash = "sha256-lHZ9SVnKcsEsnKYXR/QocGbKPEoA7yCZxXvrNPeH1rA=";
21   };
23   postPatch = ''
24     substituteInPlace setup.py \
25       --replace ", 'pytest-runner'" ""
27     substituteInPlace samplerate/lowlevel.py --replace \
28       "lib_filename = _find_library('samplerate')" \
29       'lib_filename = "${libsamplerate.out}/lib/libsamplerate${stdenv.hostPlatform.extensions.sharedLibrary}"'
30   '';
32   propagatedBuildInputs = [
33     cffi
34     numpy
35   ];
37   pythonImportsCheck = [
38     "samplerate"
39   ];
41   nativeCheckInputs = [
42     pytestCheckHook
43   ];
45   preCheck = ''
46     rm -rf samplerate
47   '';
49   meta = with lib; {
50     description = "Python bindings for libsamplerate based on CFFI and NumPy";
51     homepage = "https://github.com/tuxu/python-samplerate";
52     changelog = "https://github.com/tuxu/python-samplerate/releases/tag/${version}";
53     license = licenses.mit;
54     maintainers = with maintainers; [ hexa ];
55   };