1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 pythonOlder,
6 stdenv,
7
8 # build-system
9 cmake,
10 nanobind,
11 ninja,
12 scikit-build-core,
13 setuptools,
14 setuptools-scm,
15 typing-extensions,
16
17 # native dependencies
18 libsoxr,
19
20 # dependencies
21 numpy,
22
23 # tests
24 pytestCheckHook,
25}:
26
27buildPythonPackage rec {
28 pname = "soxr";
29 version = "0.5.0.post1";
30 pyproject = true;
31
32 src = fetchFromGitHub {
33 owner = "dofuuz";
34 repo = "python-soxr";
35 tag = "v${version}";
36 fetchSubmodules = true;
37 hash = "sha256-Fpayc+MOpDUCdpoyJaIqSbMzuO0jYb6UN5ARFaxxOHk=";
38 };
39
40 patches = [ ./cmake-nanobind.patch ];
41
42 nativeBuildInputs = [
43 cmake
44 ninja
45 ];
46
47 dontUseCmakeConfigure = true;
48
49 pypaBuildFlags = [
50 "--config=cmake.define.USE_SYSTEM_LIBSOXR=ON"
51 ];
52
53 build-system = [
54 scikit-build-core
55 nanobind
56 setuptools
57 setuptools-scm
58 ]
59 ++ lib.optionals (pythonOlder "3.11") [
60 typing-extensions
61 ];
62
63 buildInputs = [ libsoxr ];
64
65 dependencies = [ numpy ];
66
67 pythonImportsCheck = [ "soxr" ];
68
69 nativeCheckInputs = [ pytestCheckHook ];
70
71 meta = with lib; {
72 description = "High quality, one-dimensional sample-rate conversion library";
73 homepage = "https://github.com/dofuuz/python-soxr/tree/main";
74 license = licenses.lgpl21Plus;
75 maintainers = with maintainers; [ hexa ];
76 };
77}