1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cython,
8 numpy,
9 oldest-supported-numpy,
10 setuptools,
11 setuptools-scm,
12 gnutar,
13
14 # native
15 libsoxr,
16
17 # tests
18 pytestCheckHook,
19}:
20
21buildPythonPackage rec {
22 pname = "soxr";
23 version = "0.3.7";
24 format = "pyproject";
25
26 src = fetchFromGitHub {
27 owner = "dofuuz";
28 repo = "python-soxr";
29 rev = "refs/tags/v${version}";
30 fetchSubmodules = true;
31 hash = "sha256-HGtoMfMQ5/2iEIFtik7mCrSxFnLXkSSx2W8wBul0+jk=";
32 };
33
34 postPatch = ''
35 substituteInPlace setup.py \
36 --replace "SYS_LIBSOXR = False" "SYS_LIBSOXR = True"
37 '';
38
39 nativeBuildInputs = [
40 cython
41 gnutar
42 numpy
43 oldest-supported-numpy
44 setuptools
45 setuptools-scm
46 ];
47
48 buildInputs = [ libsoxr ];
49
50 pythonImportsCheck = [ "soxr" ];
51
52 nativeCheckInputs = [ pytestCheckHook ];
53
54 meta = with lib; {
55 description = "High quality, one-dimensional sample-rate conversion library";
56 homepage = "https://github.com/dofuuz/python-soxr/tree/main";
57 license = licenses.lgpl21Plus;
58 maintainers = with maintainers; [ hexa ];
59 };
60}