python312Packages.pesq: init at 0.0.4 (#350489)

This commit is contained in:
Gaétan Lepage 2024-10-22 21:48:50 +02:00 committed by GitHub
commit f66d865a1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 79 additions and 0 deletions

View File

@ -0,0 +1,77 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
# build-system
cython,
numpy,
setuptools,
# tests
pytestCheckHook,
scipy,
}:
buildPythonPackage rec {
pname = "pesq";
version = "0.0.4";
pyproject = true;
src = fetchFromGitHub {
owner = "ludlows";
repo = "PESQ";
rev = "refs/tags/v${version}";
hash = "sha256-JuwZ+trFKGMetS3cC3pEQsV+wbj6+klFnC3THOd8bPE=";
};
postPatch =
# pythonRemoveDeps does not work for removing pytest-runner
''
substituteInPlace setup.py \
--replace-fail ", 'pytest-runner'" ""
''
# Flaky tests: numerical equality is not satisfied on ARM platforms
+ ''
substituteInPlace tests/test_pesq.py \
--replace-fail \
"assert score == 1.6072081327438354" \
"assert abs(score - 1.6072081327438354) < 1e-5" \
--replace-fail \
"assert score == [1.6072081327438354]" \
"assert np.allclose(np.array(score), np.array([1.6072081327438354]))"
'';
build-system = [
cython
setuptools
numpy
];
dependencies = [
numpy
];
pythonImportsCheck = [
"pesq"
"pesq.cypesq"
];
# Prevents importing the `pesq` module from the source files (which lack the cypesq extension)
preCheck = ''
rm -rf pesq
'';
nativeCheckInputs = [
pytestCheckHook
scipy
];
meta = {
description = "PESQ (Perceptual Evaluation of Speech Quality) Wrapper for Python Users";
homepage = "https://github.com/ludlows/PESQ";
changelog = "https://github.com/ludlows/PESQ/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}

View File

@ -9892,6 +9892,8 @@ self: super: with self; {
pescea = callPackage ../development/python-modules/pescea { };
pesq = callPackage ../development/python-modules/pesq { };
pex = callPackage ../development/python-modules/pex { };
pexif = callPackage ../development/python-modules/pexif { };