about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pygobject
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pygobject')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pygobject/3.nix40
-rw-r--r--nixpkgs/pkgs/development/python-modules/pygobject/default.nix46
-rw-r--r--nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.0-fix-darwin.patch88
-rw-r--r--nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.28.6-gio-types-2.32.patch50
-rw-r--r--nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.28.6-set_qdata.patch28
5 files changed, 252 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pygobject/3.nix b/nixpkgs/pkgs/development/python-modules/pygobject/3.nix
new file mode 100644
index 000000000000..43cb77e58319
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pygobject/3.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, buildPythonPackage, pkgconfig, glib, gobject-introspection,
+pycairo, cairo, which, ncurses, meson, ninja, isPy3k, gnome3 }:
+
+buildPythonPackage rec {
+  pname = "pygobject";
+  version = "3.30.4";
+
+  format = "other";
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
+    sha256 = "0hscyvr6hh8l90fyz97b9d03506g3r8s5hl1bgk5aadq8jja3h9d";
+  };
+
+  outputs = [ "out" "dev" ];
+
+  mesonFlags = [
+    "-Dpython=python${if isPy3k then "3" else "2" }"
+  ];
+
+  nativeBuildInputs = [ pkgconfig meson ninja gobject-introspection ];
+  buildInputs = [ glib gobject-introspection ]
+                 ++ stdenv.lib.optionals stdenv.isDarwin [ which ncurses ];
+  propagatedBuildInputs = [ pycairo cairo ];
+
+  passthru = {
+    updateScript = gnome3.updateScript {
+      packageName = pname;
+      attrPath = "python3.pkgs.${pname}3";
+    };
+  };
+
+  meta = with stdenv.lib; {
+    homepage = https://pygobject.readthedocs.io/;
+    description = "Python bindings for Glib";
+    license = licenses.gpl2;
+    maintainers = with maintainers; [ jtojnar ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/python-modules/pygobject/default.nix b/nixpkgs/pkgs/development/python-modules/pygobject/default.nix
new file mode 100644
index 000000000000..4826db3a8c02
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pygobject/default.nix
@@ -0,0 +1,46 @@
+{ stdenv, fetchurl, python, buildPythonPackage, pkgconfig, glib }:
+
+buildPythonPackage rec {
+  pname = "pygobject";
+  version = "2.28.6";
+  format = "other";
+  name = pname + "-" + version;
+
+  src = fetchurl {
+    url = "mirror://gnome/sources/pygobject/2.28/${name}.tar.xz";
+    sha256 = "1f5dfxjnil2glfwxnqr14d2cjfbkghsbsn8n04js2c2icr7iv2pv";
+  };
+
+  outputs = [ "out" "devdoc" ];
+
+  patches = [
+    # Fix warning spam
+    ./pygobject-2.28.6-set_qdata.patch
+    ./pygobject-2.28.6-gio-types-2.32.patch
+  ] ++ stdenv.lib.optionals stdenv.isDarwin [
+    ./pygobject-2.0-fix-darwin.patch
+  ];
+
+  configureFlags = [ "--disable-introspection" ];
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ glib ];
+
+  # in a "normal" setup, pygobject and pygtk are installed into the
+  # same site-packages: we need a pth file for both. pygtk.py would be
+  # used to select a specific version, in our setup it should have no
+  # effect, but we leave it in case somebody expects and calls it.
+  postInstall = ''
+    mv $out/lib/${python.libPrefix}/site-packages/{pygtk.pth,${name}.pth}
+
+    # Prevent wrapping of codegen files as these are meant to be
+    # executed by the python program
+    chmod a-x $out/share/pygobject/*/codegen/*.py
+  '';
+
+  meta = {
+    homepage = http://live.gnome.org/PyGObject;
+    description = "Python bindings for Glib";
+    platforms = stdenv.lib.platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.0-fix-darwin.patch b/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.0-fix-darwin.patch
new file mode 100644
index 000000000000..7fef05262f4d
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.0-fix-darwin.patch
@@ -0,0 +1,88 @@
+--- a/gio/unix-types.defs
++++ b/gio/unix-types.defs
+@@ -7,18 +7,6 @@
+   (gtype-id "G_TYPE_UNIX_CONNECTION")
+ )
+ 
+-(define-object DesktopAppInfo
+-  (docstring
+-  "DesktopAppInfo(desktop_id) -> gio.unix.DesktopAppInfo\n\n"
+-  "gio.Unix.DesktopAppInfo is an implementation of gio.AppInfo\n"
+-  "based on desktop files."
+-  )
+-  (in-module "giounix")
+-  (parent "GObject")
+-  (c-name "GDesktopAppInfo")
+-  (gtype-id "G_TYPE_DESKTOP_APP_INFO")
+-)
+-
+ (define-object FDMessage
+   (in-module "giounix")
+   (parent "GSocketControlMessage")
+--- a/gio/unix.defs
++++ b/gio/unix.defs
+@@ -32,54 +32,6 @@
+ 
+ 
+ 
+-;; From gdesktopappinfo.h
+-
+-(define-function desktop_app_info_get_type
+-  (c-name "g_desktop_app_info_get_type")
+-  (return-type "GType")
+-)
+-
+-(define-function desktop_app_info_new_from_filename
+-  (c-name "g_desktop_app_info_new_from_filename")
+-  (return-type "GDesktopAppInfo*")
+-  (parameters
+-    '("const-char*" "filename")
+-  )
+-)
+-
+-(define-function g_desktop_app_info_new_from_keyfile
+-  (c-name "g_desktop_app_info_new_from_keyfile")
+-  (return-type "GDesktopAppInfo*")
+-  (parameters
+-    '("GKeyFile*" "key_file")
+-  )
+-)
+-
+-(define-function desktop_app_info_new
+-  (c-name "g_desktop_app_info_new")
+-  (is-constructor-of "GDesktopAppInfo")
+-  (return-type "GDesktopAppInfo*")
+-  (parameters
+-    '("const-char*" "desktop_id")
+-  )
+-)
+-
+-(define-method get_is_hidden
+-  (of-object "GDesktopAppInfo")
+-  (c-name "g_desktop_app_info_get_is_hidden")
+-  (return-type "gboolean")
+-)
+-
+-(define-function desktop_app_info_set_desktop_env
+-  (c-name "g_desktop_app_info_set_desktop_env")
+-  (return-type "none")
+-  (parameters
+-    '("const-char*" "desktop_env")
+-  )
+-)
+-
+-
+-
+ ;; From gunixfdmessage.h
+ 
+ (define-function g_unix_fd_message_get_type
+--- a/gio/unix.override
++++ b/gio/unix.override
+@@ -24,7 +24,6 @@
+ #define NO_IMPORT_PYGOBJECT
+ #include <pygobject.h>
+ #include <gio/gio.h>
+-#include <gio/gdesktopappinfo.h>
+ #include <gio/gunixinputstream.h>
+ #include <gio/gunixmounts.h>
+ #include <gio/gunixoutputstream.h>
diff --git a/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.28.6-gio-types-2.32.patch b/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.28.6-gio-types-2.32.patch
new file mode 100644
index 000000000000..fa0adf54ad04
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.28.6-gio-types-2.32.patch
@@ -0,0 +1,50 @@
+From 42d01f060c5d764baa881d13c103d68897163a49 Mon Sep 17 00:00:00 2001
+From: Ryan Lortie <desrt@desrt.ca>
+Date: Mon, 12 Mar 2012 16:44:14 -0400
+Subject: [PATCH] gio-types.defs: change some enums to flags
+
+These flags types were originally incorrectly handled in glib as being
+enums.  That bug was fixed, but they're still enums here, leading to
+warnings about the mismatch.
+
+Change them to flags.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=668522
+---
+ gio/gio-types.defs |    6 +++---
+ 1 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/gio/gio-types.defs b/gio/gio-types.defs
+index 331e0bc..7eee5c8 100644
+--- a/gio/gio-types.defs
++++ b/gio/gio-types.defs
+@@ -526,7 +526,7 @@
+   )
+ )
+ 
+-(define-enum MountMountFlags
++(define-flags MountMountFlags
+   (in-module "gio")
+   (c-name "GMountMountFlags")
+   (gtype-id "G_TYPE_MOUNT_MOUNT_FLAGS")
+@@ -545,7 +545,7 @@
+   )
+ )
+ 
+-(define-enum DriveStartFlags
++(define-flags DriveStartFlags
+   (in-module "gio")
+   (c-name "GDriveStartFlags")
+   (gtype-id "G_TYPE_DRIVE_START_FLAGS")
+@@ -770,7 +770,7 @@
+   )
+ )
+ 
+-(define-enum SocketMsgFlags
++(define-flags SocketMsgFlags
+   (in-module "gio")
+   (c-name "GSocketMsgFlags")
+   (gtype-id "G_TYPE_SOCKET_MSG_FLAGS")
+-- 
+1.7.8.5
+
diff --git a/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.28.6-set_qdata.patch b/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.28.6-set_qdata.patch
new file mode 100644
index 000000000000..55376b59d829
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pygobject/pygobject-2.28.6-set_qdata.patch
@@ -0,0 +1,28 @@
+From 42d871eb0b08ee6d55e95cc7e4b90844919555b9 Mon Sep 17 00:00:00 2001
+From: Ivan Stankovic <ivan.stankovic@avl.com>
+Date: Tue, 21 Feb 2012 12:24:58 +0100
+Subject: [PATCH] Fix set_qdata warning on accessing NULL gobject property
+
+https://bugzilla.gnome.org/show_bug.cgi?id=661155
+---
+ gobject/pygobject.c |    4 +++-
+ 1 files changed, 3 insertions(+), 1 deletions(-)
+
+diff --git a/gobject/pygobject.c b/gobject/pygobject.c
+index 6c2f06c..70dc89a 100644
+--- a/gobject/pygobject.c
++++ b/gobject/pygobject.c
+@@ -991,7 +991,9 @@ pygobject_new(GObject *obj)
+ PyObject *
+ pygobject_new_sunk(GObject *obj)
+ {
+-    g_object_set_qdata (obj, pygobject_ref_sunk_key, GINT_TO_POINTER (1));
++    if (obj)
++       g_object_set_qdata (obj, pygobject_ref_sunk_key, GINT_TO_POINTER (1));
++       
+     return pygobject_new_full(obj, TRUE, NULL);
+ }
+ 
+-- 
+1.7.8.5
+