1{
2 buildPythonPackage,
3 fetchFromGitHub,
4 fetchpatch,
5 isPy27,
6 libopus,
7 pytestCheckHook,
8 lib,
9 stdenv,
10 replaceVars,
11 setuptools,
12}:
13
14buildPythonPackage {
15 pname = "opuslib";
16 version = "3.0.3";
17 pyproject = true;
18
19 disabled = isPy27;
20
21 src = fetchFromGitHub {
22 owner = "orion-labs";
23 repo = "opuslib";
24 rev = "92109c528f9f6c550df5e5325ca0fcd4f86b0909";
25 hash = "sha256-NxmC/4TTIEDVzrfMPN4PcT1JY4QCw8IBMy80XiM/o00=";
26 };
27
28 patches = [
29 # https://github.com/orion-labs/opuslib/pull/22
30 (fetchpatch {
31 name = "fix-variadic-functions-on-aarch64-darwin.patch";
32 url = "https://github.com/orion-labs/opuslib/commit/8aee916e4da4b3183d49cff5a986dc2408076d8d.patch";
33 hash = "sha256-oa1HCFHNS3ejzSf0jxv9NueUKOZgdCtpv+xTrjYW5os=";
34 })
35 # https://github.com/orion-labs/opuslib/pull/25
36 (fetchpatch {
37 name = "fix-tests-when-using-libopus-1.4.patch";
38 url = "https://github.com/orion-labs/opuslib/commit/87a214fc98c1dcae38035e99fe8e279a160c4a52.patch";
39 hash = "sha256-UoOafyTFvWLY7ErtBhkXTZSgbMZFrg5DGxjbhqEI7wo=";
40 })
41 (replaceVars ./opuslib-paths.patch {
42 opusLibPath = "${libopus}/lib/libopus${stdenv.hostPlatform.extensions.sharedLibrary}";
43 })
44 ];
45
46 build-system = [ setuptools ];
47
48 nativeCheckInputs = [ pytestCheckHook ];
49
50 enabledTestPaths = [
51 "tests/decoder.py"
52 "tests/encoder.py"
53 "tests/hl_decoder.py"
54 "tests/hl_encoder.py"
55 ];
56
57 meta = with lib; {
58 description = "Python bindings to the libopus, IETF low-delay audio codec";
59 homepage = "https://github.com/orion-labs/opuslib";
60 license = licenses.bsd3;
61 platforms = platforms.all;
62 maintainers = with maintainers; [ thelegy ];
63 };
64}