1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 cython,
9 setuptools,
10
11 # nativeBuildInputs
12 pkg-config,
13
14 # buildInputs
15 ffmpeg-headless,
16
17 # dependencies
18
19 fetchurl,
20 linkFarm,
21 numpy,
22 pillow,
23 pytestCheckHook,
24}:
25
26buildPythonPackage rec {
27 pname = "av";
28 version = "15.1.0";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "PyAV-Org";
33 repo = "PyAV";
34 tag = "v${version}";
35 hash = "sha256-VeF6Sti1Ide2LchiCuPut/bdbJUv+5eTH2q0YMcniyA=";
36 };
37
38 build-system = [
39 cython
40 setuptools
41 ];
42
43 nativeBuildInputs = [ pkg-config ];
44
45 buildInputs = [ ffmpeg-headless ];
46
47 preCheck =
48 let
49 # Update with `./update-test-samples.bash` if necessary.
50 testSamples = linkFarm "pyav-test-samples" (
51 lib.mapAttrs (_: fetchurl) (lib.importTOML ./test-samples.toml)
52 );
53 in
54 ''
55 # ensure we import the built version
56 rm -r av
57 ln -s ${testSamples} tests/assets
58 '';
59
60 nativeCheckInputs = [
61 numpy
62 pillow
63 pytestCheckHook
64 ];
65
66 # `__darwinAllowLocalNetworking` doesn’t work for these; not sure why.
67 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [
68 "tests/test_timeout.py"
69 ];
70
71 pythonImportsCheck = [
72 "av"
73 "av.audio"
74 "av.buffer"
75 "av.bytesource"
76 "av.codec"
77 "av.container"
78 "av._core"
79 "av.datasets"
80 "av.descriptor"
81 "av.dictionary"
82 "av.error"
83 "av.filter"
84 "av.format"
85 "av.frame"
86 "av.logging"
87 "av.option"
88 "av.packet"
89 "av.plane"
90 "av.stream"
91 "av.subtitles"
92 "av.utils"
93 "av.video"
94 ];
95
96 meta = {
97 description = "Pythonic bindings for FFmpeg";
98 mainProgram = "pyav";
99 homepage = "https://github.com/PyAV-Org/PyAV";
100 changelog = "https://github.com/PyAV-Org/PyAV/blob/v${version}/CHANGELOG.rst";
101 license = lib.licenses.bsd2;
102 maintainers = [ ];
103 };
104}