depot/third_party/nixpkgs/pkgs/development/python-modules/samplerate/default.nix
Default email fa5436e0a7 Project import generated by Copybara.
GitOrigin-RevId: e8057b67ebf307f01bdcc8fba94d94f75039d1f6
2024-06-05 17:53:02 +02:00

74 lines
1.4 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
cmake,
setuptools,
setuptools-scm,
pybind11,
# dependencies
cffi,
numpy,
# native dependencies
libsamplerate,
# tests
pytestCheckHook,
}:
buildPythonPackage rec {
pname = "samplerate";
version = "0.2.1";
pyproject = true;
src = fetchFromGitHub {
owner = "tuxu";
repo = "python-samplerate";
rev = "refs/tags/v${version}";
hash = "sha256-/9NFJcn8R0DFjVhFAIYOtzZM90hjVIfsVXFlS0nHNhA=";
};
postPatch = ''
# unvendor pybind11, libsamplerate
rm -r external
substituteInPlace CMakeLists.txt \
--replace-fail "add_subdirectory(external)" "find_package(pybind11 REQUIRED)"
'';
build-system = [
cmake
setuptools
setuptools-scm
pybind11
];
dontUseCmakeConfigure = true;
buildInputs = [ libsamplerate ];
propagatedBuildInputs = [
cffi
numpy
];
pythonImportsCheck = [ "samplerate" ];
nativeCheckInputs = [ pytestCheckHook ];
preCheck = ''
rm -rf samplerate
'';
meta = with lib; {
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 ];
};
}