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 [
55 scikit-build-core
56 nanobind
57 setuptools
58 setuptools-scm
59 ]
60 ++ lib.optionals (pythonOlder "3.11") [
61 typing-extensions
62 ];
63
64 buildInputs = [ libsoxr ];
65
66 dependencies = [ numpy ];
67
68 pythonImportsCheck = [ "soxr" ];
69
70 nativeCheckInputs = [ pytestCheckHook ];
71
72 meta = with lib; {
73 description = "High quality, one-dimensional sample-rate conversion library";
74 homepage = "https://github.com/dofuuz/python-soxr/tree/main";
75 license = licenses.lgpl21Plus;
76 maintainers = with maintainers; [ hexa ];
77 };
78}