about summary refs log tree commit diff
path: root/pkgs/development/python-modules/soxr/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/soxr/default.nix')
-rw-r--r--pkgs/development/python-modules/soxr/default.nix88
1 files changed, 50 insertions, 38 deletions
diff --git a/pkgs/development/python-modules/soxr/default.nix b/pkgs/development/python-modules/soxr/default.nix
index 7cd1cc0af6bc..9095dcb7ae7f 100644
--- a/pkgs/development/python-modules/soxr/default.nix
+++ b/pkgs/development/python-modules/soxr/default.nix
@@ -1,60 +1,72 @@
-{ lib
-, buildPythonPackage
-, fetchFromGitHub
-
-# build-system
-, cython
-, numpy
-, oldest-supported-numpy
-, setuptools
-, setuptools-scm
-, gnutar
-
-# native
-, libsoxr
-
-# tests
-, pytestCheckHook
+{
+  lib,
+  buildPythonPackage,
+  fetchFromGitHub,
+  pythonOlder,
+
+  # build-system
+  cmake,
+  nanobind,
+  ninja,
+  scikit-build-core,
+  setuptools,
+  setuptools-scm,
+  typing-extensions,
+
+  # native dependencies
+  libsoxr,
+
+  # dependencies
+  numpy,
+
+  # tests
+  pytestCheckHook,
 }:
 
 buildPythonPackage rec {
   pname = "soxr";
-  version = "0.3.7";
-  format = "pyproject";
+  version = "0.5.0.post1";
+  pyproject = true;
 
   src = fetchFromGitHub {
     owner = "dofuuz";
     repo = "python-soxr";
     rev = "refs/tags/v${version}";
     fetchSubmodules = true;
-    hash = "sha256-HGtoMfMQ5/2iEIFtik7mCrSxFnLXkSSx2W8wBul0+jk=";
+    hash = "sha256-Fpayc+MOpDUCdpoyJaIqSbMzuO0jYb6UN5ARFaxxOHk=";
   };
 
-  postPatch = ''
-    substituteInPlace setup.py \
-      --replace "SYS_LIBSOXR = False" "SYS_LIBSOXR = True"
-  '';
+  patches = [ ./cmake-nanobind.patch ];
 
   nativeBuildInputs = [
-    cython
-    gnutar
-    numpy
-    oldest-supported-numpy
-    setuptools
-    setuptools-scm
+    cmake
+    ninja
   ];
 
-  buildInputs = [
-    libsoxr
-  ];
+  dontUseCmakeConfigure = true;
 
-  pythonImportsCheck = [
-    "soxr"
+  pypaBuildFlags = [
+    "--config=cmake.define.USE_SYSTEM_LIBSOXR=ON"
   ];
 
-  nativeCheckInputs = [
-    pytestCheckHook
-  ];
+  build-system =
+    [
+      scikit-build-core
+      nanobind
+      setuptools
+      setuptools-scm
+    ]
+    ++ lib.optionals (pythonOlder "3.11") [
+      typing-extensions
+    ];
+
+  buildInputs = [ libsoxr ];
+
+  dependencies = [ numpy ];
+
+  pythonImportsCheck = [ "soxr" ];
+
+  nativeCheckInputs = [ pytestCheckHook ];
 
   meta = with lib; {
     description = "High quality, one-dimensional sample-rate conversion library";