1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchurl,
6 fetchpatch,
7 meson,
8 ninja,
9
10 pkg-config,
11 python,
12 pygobject3,
13 gobject-introspection,
14 gst_all_1,
15 isPy3k,
16 directoryListingUpdater,
17}:
18
19buildPythonPackage rec {
20 pname = "gst-python";
21 version = "1.26.0";
22
23 format = "other";
24
25 outputs = [
26 "out"
27 "dev"
28 ];
29
30 src = fetchurl {
31 url = "https://gstreamer.freedesktop.org/src/gst-python/gst-python-${version}.tar.xz";
32 hash = "sha256-5QRqBdd6uxVnGtAc0ZCNF9YuWgb114Qb5DQq3io/uNs=";
33 };
34
35 patches = [
36 # Fix segfault with PyGObject>=3.52.0
37 # https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8653
38 (fetchpatch {
39 url = "https://gitlab.freedesktop.org/gstreamer/gstreamer/-/commit/69bba61e548c7a63bc18137e63e41489a7de9d36.patch";
40 stripLen = 2;
41 hash = "sha256-BfWPc8dsB09KiEm9bNT8e+jH76jiDefQlEhhLJoq7tI=";
42 })
43 ];
44
45 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
46 # The analytics tests often timeout under load on Darwin (e.g. on Hydra), so remove them
47 substituteInPlace testsuite/meson.build --replace-fail \
48 "['Test analytics', 'test_analytics.py', ['gst-plugins-bad/gst-libs/gst/analytics', 'gst-plugins-base/gst-libs/gst/video']]," \
49 ""
50 '';
51
52 # Python 2.x is not supported.
53 disabled = !isPy3k;
54
55 depsBuildBuild = [ pkg-config ];
56
57 nativeBuildInputs = [
58 meson
59 ninja
60 pkg-config
61 gobject-introspection
62 gst_all_1.gst-plugins-base
63 ];
64
65 buildInputs = [
66 # for gstreamer-analytics-1.0
67 gst_all_1.gst-plugins-bad
68 ];
69
70 propagatedBuildInputs = [
71 gst_all_1.gst-plugins-base
72 pygobject3
73 ];
74
75 checkInputs = [
76 gst_all_1.gst-rtsp-server
77 ];
78
79 mesonFlags = [
80 "-Dpygi-overrides-dir=${placeholder "out"}/${python.sitePackages}/gi/overrides"
81 # Exec format error during configure
82 "-Dpython-exe=${python.pythonOnBuildForHost.interpreter}"
83 ];
84
85 # TODO: Meson setup hook does not like buildPythonPackage
86 # https://github.com/NixOS/nixpkgs/issues/47390
87 installCheckPhase = "meson test --print-errorlogs";
88
89 preCheck = lib.optionalString stdenv.hostPlatform.isDarwin ''
90 export DYLD_LIBRARY_PATH="${gst_all_1.gst-plugins-base}/lib"
91 '';
92
93 passthru = {
94 updateScript = directoryListingUpdater { };
95 };
96
97 meta = {
98 homepage = "https://gstreamer.freedesktop.org";
99 description = "Python bindings for GStreamer";
100 license = lib.licenses.lgpl2Plus;
101 maintainers = [ ];
102 };
103}