2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2023-03-15 16:39:30 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2022-03-30 09:31:56 +00:00
|
|
|
, fetchFromGitHub
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
# build-system
|
|
|
|
, cmake
|
|
|
|
, setuptools
|
|
|
|
, setuptools-scm
|
|
|
|
, pybind11
|
|
|
|
|
|
|
|
# dependencies
|
2023-03-15 16:39:30 +00:00
|
|
|
, cffi
|
|
|
|
, numpy
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
# native dependencies
|
2023-03-15 16:39:30 +00:00
|
|
|
, libsamplerate
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
# tests
|
2023-03-15 16:39:30 +00:00
|
|
|
, 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;
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libsamplerate
|
|
|
|
];
|
|
|
|
|
2023-03-15 16:39:30 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
cffi
|
|
|
|
numpy
|
|
|
|
];
|
|
|
|
|
|
|
|
pythonImportsCheck = [
|
|
|
|
"samplerate"
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
|
|
|
|
|
|
|
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
|
|
|
};
|
|
|
|
}
|