2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
cmake,
|
|
|
|
setuptools,
|
|
|
|
setuptools-scm,
|
|
|
|
pybind11,
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# dependencies
|
|
|
|
cffi,
|
|
|
|
numpy,
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# native dependencies
|
|
|
|
libsamplerate,
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
pytestCheckHook,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "samplerate";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "0.2.1";
|
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-30 09:31:56 +00:00
|
|
|
src = fetchFromGitHub {
|
2023-03-15 16:39:30 +00:00
|
|
|
owner = "tuxu";
|
|
|
|
repo = "python-samplerate";
|
2024-05-15 15:35:15 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-/9NFJcn8R0DFjVhFAIYOtzZM90hjVIfsVXFlS0nHNhA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
postPatch = ''
|
2024-05-15 15:35:15 +00:00
|
|
|
# unvendor pybind11, libsamplerate
|
|
|
|
rm -r external
|
|
|
|
substituteInPlace CMakeLists.txt \
|
|
|
|
--replace-fail "add_subdirectory(external)" "find_package(pybind11 REQUIRED)"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
build-system = [
|
|
|
|
cmake
|
|
|
|
setuptools
|
|
|
|
setuptools-scm
|
|
|
|
pybind11
|
|
|
|
];
|
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
buildInputs = [ libsamplerate ];
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cffi
|
|
|
|
numpy
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "samplerate" ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2023-03-15 16:39:30 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
rm -rf samplerate
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-03-15 16:39:30 +00:00
|
|
|
description = "Python bindings for libsamplerate based on CFFI and NumPy";
|
|
|
|
homepage = "https://github.com/tuxu/python-samplerate";
|
|
|
|
changelog = "https://github.com/tuxu/python-samplerate/releases/tag/${version}";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ hexa ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|