blob: ccb8de7939b3446953f5eb1360e4489235f9109d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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";
tag = "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 ];
};
}
|