diff options
-rw-r--r-- | .SRCINFO | 22 | ||||
-rw-r--r-- | 01_cairo_region.patch | 143 | ||||
-rw-r--r-- | PKGBUILD | 12 |
3 files changed, 14 insertions, 163 deletions
@@ -1,39 +1,37 @@ # Generated by mksrcinfo v8 -# Sun Jul 23 14:34:55 UTC 2017 +# Tue Oct 10 05:46:32 UTC 2017 pkgbase = pygobject-patched pkgdesc = Python Bindings for GLib/GObject/GIO/GTK+ - pkgver = 3.24.1 + pkgver = 3.26.0 pkgrel = 1 url = https://wiki.gnome.org/Projects/PyGObject arch = i686 arch = x86_64 license = LGPL - makedepends = python-cairo-git + makedepends = python-cairo makedepends = python2-cairo makedepends = gobject-introspection makedepends = gnome-common depends = gobject-introspection-runtime optdepends = cairo: Cairo bindings - source = https://download.gnome.org/sources/pygobject/3.24/pygobject-3.24.1.tar.xz - source = 01_cairo_region.patch - sha256sums = a628a95aa0909e13fb08230b1b98fc48adef10b220932f76d62f6821b3fdbffd - sha256sums = 70d890c4f56cb677a386dcd5cfe554957c200802b788e582b22b09ba49a423a2 + source = https://download.gnome.org/sources/pygobject/3.26/pygobject-3.26.0.tar.xz + sha256sums = 7411acd600c8cb6f00d2125afa23303f2104e59b83e0a4963288dbecc3b029fa pkgname = python-gobject-patched - depends = pygobject-devel=3.24.1 + depends = pygobject-devel=3.26.0 depends = python - provides = python-gobject=3.24.1 + provides = python-gobject=3.26.0 conflicts = python-gobject pkgname = python2-gobject-patched pkgdesc = Python2 Bindings for GLib/GObject/GIO/GTK+ - depends = pygobject-devel=3.24.1 + depends = pygobject-devel=3.26.0 depends = python2 - provides = python2-gobject=3.24.1 + provides = python2-gobject=3.26.0 conflicts = python2-gobject pkgname = pygobject-devel-patched pkgdesc = Common development files for pygobject - provides = pygobject-devel=3.24.1 + provides = pygobject-devel=3.26.0 conflicts = pygobject-devel diff --git a/01_cairo_region.patch b/01_cairo_region.patch deleted file mode 100644 index 1de144d7d2ec..000000000000 --- a/01_cairo_region.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 154b79f7447b1fecf73ba837192263acbe3b5837 Mon Sep 17 00:00:00 2001 -From: Shyouzou Sugitani <shy@users.sourceforge.jp> -Date: Mon, 6 Jun 2016 12:26:44 +0200 -Subject: [PATCH] Add a foreign type for cairo_region_t. - -Based on the patch at - https://bugzilla.gnome.org/show_bug.cgi?id=667959#c7 - -* Rebased on master -* Fixes the cairo_region_from_arg signature -* Add check for pycairo region support (only in pycairo master) -* Add some tests - -Co-Authored-By: Martin Pitt <martin.pitt@ubuntu.com> -Co-Authored-By: Christoph Reiter <creiter@src.gnome.org> - -https://bugzilla.gnome.org/show_bug.cgi?id=667959 ---- - gi/pygi-foreign-cairo.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ - tests/test_cairo.py | 28 +++++++++++++++++++++++++-- - 2 files changed, 77 insertions(+), 2 deletions(-) - -diff --git a/gi/pygi-foreign-cairo.c b/gi/pygi-foreign-cairo.c -index 8e76529..3ad3a99 100644 ---- a/gi/pygi-foreign-cairo.c -+++ b/gi/pygi-foreign-cairo.c -@@ -367,6 +367,49 @@ cairo_pattern_from_gvalue (const GValue *value) - return PycairoPattern_FromPattern (pattern, NULL); - } - -+#if PY_VERSION_HEX >= 0x03000000 && defined(PycairoRegion_Type) -+ -+static PyObject * -+cairo_region_to_arg (PyObject *value, -+ GIInterfaceInfo *interface_info, -+ GITransfer transfer, -+ GIArgument *arg) -+{ -+ cairo_region_t *region; -+ -+ g_assert (transfer == GI_TRANSFER_NOTHING); -+ -+ region = ( (PycairoRegion*) value)->region; -+ if (!region) { -+ PyErr_SetString (PyExc_ValueError, "Region instance wrapping a NULL region"); -+ return NULL; -+ } -+ -+ arg->v_pointer = region; -+ Py_RETURN_NONE; -+} -+ -+static PyObject * -+cairo_region_from_arg (GIInterfaceInfo *interface_info, -+ GITransfer transfer, -+ gpointer data) -+{ -+ cairo_region_t *region = (cairo_region_t*) data; -+ -+ if (transfer == GI_TRANSFER_NOTHING) -+ cairo_region_reference (region); -+ -+ return PycairoRegion_FromRegion (region); -+} -+ -+static PyObject * -+cairo_region_release (GIBaseInfo *base_info, -+ gpointer struct_) -+{ -+ cairo_region_destroy ( (cairo_region_t*) struct_); -+ Py_RETURN_NONE; -+} -+#endif - - static PyMethodDef _gi_cairo_functions[] = { {0,} }; - PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo") -@@ -406,6 +449,14 @@ PYGLIB_MODULE_START(_gi_cairo, "_gi_cairo") - cairo_font_options_from_arg, - cairo_font_options_release); - -+#if PY_VERSION_HEX >= 0x03000000 && defined(PycairoRegion_Type) -+ pygi_register_foreign_struct ("cairo", -+ "Region", -+ cairo_region_to_arg, -+ cairo_region_from_arg, -+ cairo_region_release); -+#endif -+ - pyg_register_gtype_custom (CAIRO_GOBJECT_TYPE_CONTEXT, - cairo_context_from_gvalue, - cairo_context_to_gvalue); -diff --git a/tests/test_cairo.py b/tests/test_cairo.py -index fdf86a2..02049c0 100644 ---- a/tests/test_cairo.py -+++ b/tests/test_cairo.py -@@ -14,11 +14,14 @@ try: - except ImportError: - has_cairo = False - -+has_region = has_cairo and hasattr(cairo, "Region") -+ - try: -- from gi.repository import Gtk -- Gtk # pyflakes -+ from gi.repository import Gtk, Gdk -+ Gtk, Gdk # pyflakes - except: - Gtk = None -+ Gdk = None - - from gi.repository import GObject - -@@ -67,6 +70,27 @@ class Test(unittest.TestCase): - - - @unittest.skipUnless(has_cairo, 'built without cairo support') -+@unittest.skipUnless(has_region, 'built without cairo.Region support') -+@unittest.skipUnless(Gdk, 'Gdk not available') -+class TestRegion(unittest.TestCase): -+ -+ def test_region_to_py(self): -+ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) -+ context = cairo.Context(surface) -+ context.paint() -+ region = Gdk.cairo_region_create_from_surface(surface) -+ r = region.get_extents() -+ self.assertEqual((r.height, r.width), (10, 10)) -+ -+ def test_region_from_py(self): -+ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 10, 10) -+ context = cairo.Context(surface) -+ region = cairo.Region(cairo.RectangleInt(0, 0, 42, 42)) -+ Gdk.cairo_region(context, region) -+ self.assertTrue("42" in repr(list(context.copy_path()))) -+ -+ -+@unittest.skipUnless(has_cairo, 'built without cairo support') - @unittest.skipUnless(Gtk, 'Gtk not available') - class TestPango(unittest.TestCase): - def test_cairo_font_options(self): --- -2.8.1 - @@ -4,24 +4,20 @@ _pkgbase=pygobject pkgbase=pygobject-patched pkgname=(python-gobject-patched python2-gobject-patched pygobject-devel-patched) -pkgver=3.24.1 +pkgver=3.26.0 pkgrel=1 pkgdesc="Python Bindings for GLib/GObject/GIO/GTK+" url="https://wiki.gnome.org/Projects/PyGObject" arch=(i686 x86_64) license=(LGPL) depends=(gobject-introspection-runtime) -makedepends=(python-cairo-git python2-cairo gobject-introspection gnome-common) +makedepends=(python-cairo python2-cairo gobject-introspection gnome-common) optdepends=('cairo: Cairo bindings') -source=("https://download.gnome.org/sources/${_pkgbase}/${pkgver:0:4}/${_pkgbase}-${pkgver}.tar.xz" - "01_cairo_region.patch") -sha256sums=('a628a95aa0909e13fb08230b1b98fc48adef10b220932f76d62f6821b3fdbffd' - '70d890c4f56cb677a386dcd5cfe554957c200802b788e582b22b09ba49a423a2') +source=("https://download.gnome.org/sources/${_pkgbase}/${pkgver:0:4}/${_pkgbase}-${pkgver}.tar.xz") +sha256sums=('7411acd600c8cb6f00d2125afa23303f2104e59b83e0a4963288dbecc3b029fa') prepare() { mkdir -p build-py{2,3} devel - cd ${_pkgbase}-${pkgver} - patch -Np1 -i "$srcdir/01_cairo_region.patch" } _build() ( |