1{ buildPythonPackage
2, fetchurl
3, meson
4, ninja
5, stdenv
6, pkgconfig
7, python
8, pygobject3
9, gobject-introspection
10, gst-plugins-base
11, isPy3k
12, fetchpatch
13}:
14
15buildPythonPackage rec {
16 pname = "gst-python";
17 version = "1.16.2";
18
19 format = "other";
20
21 outputs = [ "out" "dev" ];
22
23 src = fetchurl {
24 url = "${meta.homepage}/src/gst-python/${pname}-${version}.tar.xz";
25 sha256 = "1a48ca66izmm8hnp608jv5isg3jxb0vlfmhns0bg9nbkilag7390";
26 };
27
28 nativeBuildInputs = [
29 meson
30 ninja
31 pkgconfig
32 python
33 gobject-introspection
34 gst-plugins-base
35 ];
36
37 propagatedBuildInputs = [
38 gst-plugins-base
39 pygobject3
40 ];
41
42 patches = stdenv.lib.optionals stdenv.isDarwin [
43 # Fix configure python lib detection in macOS. Remove with the next release
44 (fetchpatch {
45 url = "https://github.com/GStreamer/gst-python/commit/f98c206bdf01529f8ea395a719b10baf2bdf717f.patch";
46 sha256 = "04n4zrnfivgr7iaqw4sjlbd882s8halc2bbbhfxqf0sg2lqwmrxg";
47 })
48 ] ++ [
49 # Fix linking against Python 3.8
50 # https://gitlab.freedesktop.org/gstreamer/gst-python/merge_requests/30
51 (fetchpatch {
52 url = "https://gitlab.freedesktop.org/gstreamer/gst-python/commit/22f28155d86e27c4134de4ed2861264003fcfd23.patch";
53 sha256 = "Y70qVguHUBmmRVMFBKAP0d6anBQw5W0TKyu2bAwxbQg=";
54 })
55 ];
56
57 mesonFlags = [
58 "-Dpython=python${if isPy3k then "3" else "2"}"
59 "-Dpygi-overrides-dir=${placeholder "out"}/${python.sitePackages}/gi/overrides"
60 ];
61
62 doCheck = true;
63
64 # TODO: Meson setup hook does not like buildPythonPackage
65 # https://github.com/NixOS/nixpkgs/issues/47390
66 installCheckPhase = "meson test --print-errorlogs";
67
68 meta = {
69 homepage = "https://gstreamer.freedesktop.org";
70
71 description = "Python bindings for GStreamer";
72
73 license = stdenv.lib.licenses.lgpl2Plus;
74 };
75}