From 0d2f06ae3a1f8347dc09cd0dfe6d12b757368e4d Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 5 Sep 2018 14:12:02 +0200 Subject: [PATCH] python2.pkgs.gst-python: fix build --- .../python-modules/gst-python/default.nix | 40 +++++++++++++------ .../different-path-with-pygobject.patch | 20 ---------- 2 files changed, 27 insertions(+), 33 deletions(-) delete mode 100644 pkgs/development/python-modules/gst-python/different-path-with-pygobject.patch diff --git a/pkgs/development/python-modules/gst-python/default.nix b/pkgs/development/python-modules/gst-python/default.nix index 057c24f79c3..8cbc08dbbfd 100644 --- a/pkgs/development/python-modules/gst-python/default.nix +++ b/pkgs/development/python-modules/gst-python/default.nix @@ -1,5 +1,5 @@ -{ buildPythonPackage, fetchurl, stdenv, meson, ninja, pkgconfig, python, pygobject3 -, gst-plugins-base, ncurses +{ buildPythonPackage, fetchurl, meson, ninja, stdenv, pkgconfig, python, pygobject3 +, gobjectIntrospection, gst-plugins-base, isPy3k }: let @@ -10,6 +10,8 @@ in buildPythonPackage rec { inherit pname version; format = "other"; + outputs = [ "out" "dev" ]; + src = fetchurl { urls = [ "${meta.homepage}/src/gst-python/${name}.tar.xz" @@ -18,22 +20,34 @@ in buildPythonPackage rec { sha256 = "06ssx19fs6pg4d32p9ph9w4f0xwmxaw2dxfj17rqkn5njd7v5zfh"; }; - outputs = [ "out" "dev" ]; - - nativeBuildInputs = [ meson ninja pkgconfig python ]; - - # XXX: in the Libs.private field of python3.pc - buildInputs = [ ncurses ]; - - mesonFlags = [ - "-Dpygi-overrides-dir=${python.sitePackages}/gi/overrides" + patches = [ + # Meson build does not support Python 2 at the moment + # https://bugzilla.gnome.org/show_bug.cgi?id=796092 + (fetchurl { + name = "0002-meson-use-new-python-module.patch"; + url = https://bugzilla.gnome.org/attachment.cgi?id=371989; + sha256 = "1k46nvw175c1wvkqnx783i9d4w9vn431spcl48jb3y224jj3va08"; + }) ]; + # TODO: First python_dep in meson.build needs to be removed postPatch = '' - chmod +x scripts/pythondetector # patchShebangs requires executable file - patchShebangs scripts/pythondetector + substituteInPlace meson.build --replace python3 python${if isPy3k then "3" else "2"} ''; + nativeBuildInputs = [ meson ninja pkgconfig python gobjectIntrospection ]; + + mesonFlags = [ + "-Dpython=python${if isPy3k then "3" else "2"}" + "-Dpygi-overrides-dir=${placeholder "out"}/${python.sitePackages}/gi/overrides" + ]; + + doCheck = true; + + # TODO: Meson setup hook does not like buildPythonPackage + # https://github.com/NixOS/nixpkgs/issues/47390 + installCheckPhase = "meson test --print-errorlogs"; + propagatedBuildInputs = [ gst-plugins-base pygobject3 ]; meta = { diff --git a/pkgs/development/python-modules/gst-python/different-path-with-pygobject.patch b/pkgs/development/python-modules/gst-python/different-path-with-pygobject.patch deleted file mode 100644 index 7326b3630f7..00000000000 --- a/pkgs/development/python-modules/gst-python/different-path-with-pygobject.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff -Nru gst-python-1.2.0-orig/gi/overrides/Makefile.in gst-python-1.2.0/gi/overrides/Makefile.in ---- gst-python-1.2.0-orig/gi/overrides/Makefile.in 2014-03-22 21:47:56.235364405 +0800 -+++ gst-python-1.2.0/gi/overrides/Makefile.in 2014-03-22 21:48:28.737958066 +0800 -@@ -356,7 +356,7 @@ - - # We install everything in the gi/overrides folder - pygioverridesdir = $(PYGI_OVERRIDES_DIR) --pygioverrides_PYTHON = Gst.py GstPbutils.py -+pygioverrides_PYTHON = Gst.py GstPbutils.py __init__.py - pygioverridesexecdir = $(PYGI_OVERRIDES_DIR) - EXTRA_DIST = Gst.py - INCLUDES = $(PYTHON_INCLUDES) -diff -Nru gst-python-1.2.0-orig/gi/overrides/__init__.py gst-python-1.2.0/gi/overrides/__init__.py ---- gst-python-1.2.0-orig/gi/overrides/__init__.py 1970-01-01 08:00:00.000000000 +0800 -+++ gst-python-1.2.0/gi/overrides/__init__.py 2014-03-22 21:48:15.442124287 +0800 -@@ -0,0 +1,4 @@ -+from pkgutil import extend_path -+ -+__path__ = extend_path(__path__, __name__) -+print(__path__, __name__)