1 |
commit: 2b54ba0b815698d27e932a12b7f0df0f41e761e3 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Oct 15 10:59:54 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Oct 15 11:01:26 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b54ba0b |
7 |
|
8 |
dev-python/pycairo: Move patches to a dist tarball |
9 |
|
10 |
Closes: https://bugs.gentoo.org/620566 |
11 |
|
12 |
dev-python/pycairo/Manifest | 1 + |
13 |
.../pycairo/files/py2cairo-1.10.0-ppc-darwin.patch | 18 - |
14 |
.../pycairo/files/py2cairo-1.10.0-svg_check.patch | 126 --- |
15 |
.../pycairo/files/py2cairo-1.10.0-xpyb.patch | 38 - |
16 |
.../files/pycairo-1.10.0-101_pycairo-region.patch | 917 --------------------- |
17 |
...pycairo-1.10.0-50_specify-encoding-in-waf.patch | 32 - |
18 |
.../files/pycairo-1.10.0-80_fix-pickle.patch | 30 - |
19 |
.../files/pycairo-1.10.0-81_pickling-again.patch | 37 - |
20 |
.../pycairo/files/pycairo-1.10.0-svg_check.patch | 126 --- |
21 |
.../pycairo/files/pycairo-1.10.0-waf-py3_4.patch | 11 - |
22 |
.../pycairo/files/pycairo-1.10.0-waf-unpack.patch | 12 - |
23 |
dev-python/pycairo/files/pycairo-1.10.0-xpyb.patch | 41 - |
24 |
dev-python/pycairo/pycairo-1.10.0-r5.ebuild | 27 +- |
25 |
13 files changed, 15 insertions(+), 1401 deletions(-) |
26 |
|
27 |
diff --git a/dev-python/pycairo/Manifest b/dev-python/pycairo/Manifest |
28 |
index 723b16edc34..5577f0d07b8 100644 |
29 |
--- a/dev-python/pycairo/Manifest |
30 |
+++ b/dev-python/pycairo/Manifest |
31 |
@@ -1,3 +1,4 @@ |
32 |
DIST py2cairo-1.10.0.tar.bz2 402070 SHA256 d30439f06c2ec1a39e27464c6c828b6eface3b22ee17b2de05dc409e429a7431 SHA512 cb3d54de9af4134460ce731da8166a3127a642c8a2e6184109437ddec115cd55b8dd2413a5c81700277bfe2f22fcfe268db4f3ba0f7649751e85bb34295f79fc WHIRLPOOL 60b57d55b27f06acd62714ac6ad7973ab973d42995fb536ae800263a2e8c7451a24ccafd96fe30f5bfa26e1ae218934d4fafaafec3e9666a39b33c78672407e2 |
33 |
+DIST pycairo-1.10.0-gentoo-patchset.tar.bz2 9669 SHA256 31b5aef32b5d2fb3d8e1c6f9629e6d78e6b3928a3a1c7e44af2120f38490d00e SHA512 c367a7d8fa771ac900ca3363cb7dfd50de045cf67c73c6e552d05018c6933b13dd5660b033be59e1acf8af79f16253a8e56aaa3f135a262a8148711ae8b7a587 WHIRLPOOL 65890911ee35568fceaa5146bf5e4718011eb2f606dc6c180e7ce612fe2351488c7ad2ea2322ec1ca55eb0f8b6f4fb3fb759152be525d20f80922d707108bc9e |
34 |
DIST pycairo-1.10.0.tar.bz2 246556 SHA256 9aa4078e7eb5be583aeabbe8d87172797717f95e8c4338f0d4a17b683a7253be SHA512 a03db6f04cea504985f390b0734042390f491f32ae2bee1299dabbafd369fde36bb506ebb941d22bbc11b0d008c4f758baeacf309a7336880529455092db829f WHIRLPOOL e779d56d67ef18bbd052d81acb38d8b610ca4bbf787f4b0e3982633de55ff54d6dfa3e5ce1957321fba09f0ec2d12ce12057335de9d5ff3f84c2bc0530415e76 |
35 |
DIST pycairo-1.15.3.tar.gz 177056 SHA256 8642e36cef66acbfc02760d2b40c716f5f183d073fb063ba28fd29a14044719d SHA512 1fc75d193eacb976f2e5a594aa07409a0f80ccb21921065c1794961143785eed48be1966d2d2d3e2d0428f9b4e956994dd851d21f3c3cb91fbc27b007a901ce8 WHIRLPOOL e9248366c8eb541bc70ad73c9c6eea995a2527d189584a1ec6f6b835fdeae57d1aa63e2deaa9f790042d0670e7d07af8867b111ac107b53befd354c3cfc70ca1 |
36 |
|
37 |
diff --git a/dev-python/pycairo/files/py2cairo-1.10.0-ppc-darwin.patch b/dev-python/pycairo/files/py2cairo-1.10.0-ppc-darwin.patch |
38 |
deleted file mode 100644 |
39 |
index e921ac34acd..00000000000 |
40 |
--- a/dev-python/pycairo/files/py2cairo-1.10.0-ppc-darwin.patch |
41 |
+++ /dev/null |
42 |
@@ -1,18 +0,0 @@ |
43 |
-inspired by: |
44 |
-http://groups.google.com/group/waf-users/browse_thread/thread/2bd6774056c850bc/ |
45 |
-27bfdcac2fb9ec05?lnk=gst#27bfdcac2fb9ec05 |
46 |
- |
47 |
-we cannot "fix" the buildsystem, since it's bzip2-tarred *sigh* |
48 |
- |
49 |
- |
50 |
---- waf |
51 |
-+++ waf |
52 |
-@@ -154,6 +154,8 @@ |
53 |
- |
54 |
- wafdir = find_lib() |
55 |
- sys.path.insert(0, wafdir) |
56 |
-+from waflib.Tools.c_config import MACRO_TO_DESTOS |
57 |
-+MACRO_TO_DESTOS['__POWERPC__'] = 'darwin' |
58 |
- |
59 |
- if __name__ == '__main__': |
60 |
- import waflib.extras.compat15 |
61 |
|
62 |
diff --git a/dev-python/pycairo/files/py2cairo-1.10.0-svg_check.patch b/dev-python/pycairo/files/py2cairo-1.10.0-svg_check.patch |
63 |
deleted file mode 100644 |
64 |
index 4cd755c8d57..00000000000 |
65 |
--- a/dev-python/pycairo/files/py2cairo-1.10.0-svg_check.patch |
66 |
+++ /dev/null |
67 |
@@ -1,126 +0,0 @@ |
68 |
---- src/cairomodule.c |
69 |
-+++ src/cairomodule.c |
70 |
-@@ -127,7 +127,7 @@ |
71 |
- #else |
72 |
- 0, |
73 |
- #endif |
74 |
--#ifdef CAIRO_HAS_SVG_SURFACE |
75 |
-+#ifdef PYCAIRO_ENABLE_SVG |
76 |
- &PycairoSVGSurface_Type, |
77 |
- #else |
78 |
- 0, |
79 |
-@@ -223,7 +223,7 @@ |
80 |
- if (PyType_Ready(&PycairoPSSurface_Type) < 0) |
81 |
- return; |
82 |
- #endif |
83 |
--#ifdef CAIRO_HAS_SVG_SURFACE |
84 |
-+#ifdef PYCAIRO_ENABLE_SVG |
85 |
- if (PyType_Ready(&PycairoSVGSurface_Type) < 0) |
86 |
- return; |
87 |
- #endif |
88 |
-@@ -305,7 +305,7 @@ |
89 |
- PyModule_AddObject(m, "PSSurface", (PyObject *)&PycairoPSSurface_Type); |
90 |
- #endif |
91 |
- |
92 |
--#ifdef CAIRO_HAS_SVG_SURFACE |
93 |
-+#ifdef PYCAIRO_ENABLE_SVG |
94 |
- Py_INCREF(&PycairoSVGSurface_Type); |
95 |
- PyModule_AddObject(m, "SVGSurface", (PyObject *)&PycairoSVGSurface_Type); |
96 |
- #endif |
97 |
-@@ -379,7 +379,7 @@ |
98 |
- #else |
99 |
- PyModule_AddIntConstant(m, "HAS_PS_SURFACE", 0); |
100 |
- #endif |
101 |
--#if CAIRO_HAS_SVG_SURFACE |
102 |
-+#if PYCAIRO_ENABLE_SVG |
103 |
- PyModule_AddIntConstant(m, "HAS_SVG_SURFACE", 1); |
104 |
- #else |
105 |
- PyModule_AddIntConstant(m, "HAS_SVG_SURFACE", 0); |
106 |
---- src/private.h |
107 |
-+++ src/private.h |
108 |
-@@ -86,7 +86,7 @@ |
109 |
- extern PyTypeObject PycairoPSSurface_Type; |
110 |
- #endif |
111 |
- |
112 |
--#if CAIRO_HAS_SVG_SURFACE |
113 |
-+#if PYCAIRO_ENABLE_SVG |
114 |
- extern PyTypeObject PycairoSVGSurface_Type; |
115 |
- #endif |
116 |
- |
117 |
---- src/pycairo.h |
118 |
-+++ src/pycairo.h |
119 |
-@@ -182,7 +182,7 @@ |
120 |
- #define PycairoPSSurface_Type *(Pycairo_CAPI->PSSurface_Type) |
121 |
- #endif |
122 |
- |
123 |
--#if CAIRO_HAS_SVG_SURFACE |
124 |
-+#if PYCAIRO_ENABLE_SVG |
125 |
- #define PycairoSVGSurface_Type *(Pycairo_CAPI->SVGSurface_Type) |
126 |
- #endif |
127 |
- |
128 |
---- src/surface.c |
129 |
-+++ src/surface.c |
130 |
-@@ -83,7 +83,7 @@ |
131 |
- type = &PycairoPSSurface_Type; |
132 |
- break; |
133 |
- #endif |
134 |
--#if CAIRO_HAS_SVG_SURFACE |
135 |
-+#if PYCAIRO_ENABLE_SVG |
136 |
- case CAIRO_SURFACE_TYPE_SVG: |
137 |
- type = &PycairoSVGSurface_Type; |
138 |
- break; |
139 |
-@@ -1015,7 +1015,7 @@ |
140 |
- |
141 |
- |
142 |
- /* Class SVGSurface(Surface) ----------------------------------------------- */ |
143 |
--#ifdef CAIRO_HAS_SVG_SURFACE |
144 |
-+#ifdef PYCAIRO_ENABLE_SVG |
145 |
- #include <cairo-svg.h> |
146 |
- |
147 |
- static PyObject * |
148 |
-@@ -1125,7 +1125,7 @@ |
149 |
- 0, /* tp_is_gc */ |
150 |
- 0, /* tp_bases */ |
151 |
- }; |
152 |
--#endif /* CAIRO_HAS_SVG_SURFACE */ |
153 |
-+#endif /* PYCAIRO_ENABLE_SVG */ |
154 |
- |
155 |
- |
156 |
- #if CAIRO_HAS_WIN32_SURFACE |
157 |
---- wscript |
158 |
-+++ wscript |
159 |
-@@ -1,6 +1,7 @@ |
160 |
- # -*- python -*- |
161 |
- |
162 |
- import os |
163 |
-+import subprocess |
164 |
- |
165 |
- top = '.' |
166 |
- out = 'build_directory' |
167 |
-@@ -11,6 +12,17 @@ |
168 |
- cairo_version_required = '1.10.0' |
169 |
- |
170 |
- |
171 |
-+def check_svg(): |
172 |
-+ if os.environ.get('PYCAIRO_DISABLE_SVG', None) is None: |
173 |
-+ return_code = subprocess.call(['pkg-config', '--exists', 'cairo-svg']) |
174 |
-+ if return_code == 0: |
175 |
-+ return True |
176 |
-+ else: |
177 |
-+ return False |
178 |
-+ else: |
179 |
-+ return False |
180 |
-+ |
181 |
-+ |
182 |
- def options(ctx): |
183 |
- print(' %s/options()' %d) |
184 |
- ctx.tool_options('gnu_dirs') |
185 |
-@@ -39,6 +51,8 @@ |
186 |
- ctx.define('PYCAIRO_VERSION_MAJOR', version[0]) |
187 |
- ctx.define('PYCAIRO_VERSION_MINOR', version[1]) |
188 |
- ctx.define('PYCAIRO_VERSION_MICRO', version[2]) |
189 |
-+ if check_svg(): |
190 |
-+ ctx.define('PYCAIRO_ENABLE_SVG', 1) |
191 |
- |
192 |
- ctx.write_config_header('src/config.h') |
193 |
- |
194 |
|
195 |
diff --git a/dev-python/pycairo/files/py2cairo-1.10.0-xpyb.patch b/dev-python/pycairo/files/py2cairo-1.10.0-xpyb.patch |
196 |
deleted file mode 100644 |
197 |
index c136cb0c39a..00000000000 |
198 |
--- a/dev-python/pycairo/files/py2cairo-1.10.0-xpyb.patch |
199 |
+++ /dev/null |
200 |
@@ -1,38 +0,0 @@ |
201 |
---- py2cairo-1.10.0/wscript |
202 |
-+++ py2cairo-1.10.0/wscript |
203 |
-@@ -10,6 +10,7 @@ |
204 |
- APPNAME='py2cairo' |
205 |
- VERSION='1.10.0' |
206 |
- cairo_version_required = '1.10.0' |
207 |
-+xpyb_version_required = '1.3' |
208 |
- |
209 |
- |
210 |
- def check_svg(): |
211 |
-@@ -23,6 +24,17 @@ |
212 |
- return False |
213 |
- |
214 |
- |
215 |
-+def check_xpyb(): |
216 |
-+ if os.environ.get('PYCAIRO_DISABLE_XPYB', None) is None: |
217 |
-+ return_code = subprocess.call(['pkg-config', '--exists', 'xpyb']) |
218 |
-+ if return_code == 0: |
219 |
-+ return True |
220 |
-+ else: |
221 |
-+ return False |
222 |
-+ else: |
223 |
-+ return False |
224 |
-+ |
225 |
-+ |
226 |
- def options(ctx): |
227 |
- print(' %s/options()' %d) |
228 |
- ctx.tool_options('gnu_dirs') |
229 |
-@@ -41,6 +53,9 @@ |
230 |
- ctx.check_python_headers() |
231 |
- ctx.check_cfg(package='cairo', atleast_version=cairo_version_required, |
232 |
- args='--cflags --libs') |
233 |
-+ if check_xpyb(): |
234 |
-+ ctx.check_cfg(package='xpyb', atleast_version=xpyb_version_required, |
235 |
-+ args='--cflags --libs', mandatory=False) |
236 |
- |
237 |
- # add gcc options |
238 |
- if env['CC_NAME'] == 'gcc': |
239 |
|
240 |
diff --git a/dev-python/pycairo/files/pycairo-1.10.0-101_pycairo-region.patch b/dev-python/pycairo/files/pycairo-1.10.0-101_pycairo-region.patch |
241 |
deleted file mode 100644 |
242 |
index 4143f33cb24..00000000000 |
243 |
--- a/dev-python/pycairo/files/pycairo-1.10.0-101_pycairo-region.patch |
244 |
+++ /dev/null |
245 |
@@ -1,917 +0,0 @@ |
246 |
-Description: Add support for cairo_region_t |
247 |
- This patch fix missing support for cairo_region_t. |
248 |
-Author: Bug Fly |
249 |
-Origin: https://bugs.freedesktop.org/attachment.cgi?id=61553 |
250 |
-Bug-Debian: http://bugs.debian.org/688079 |
251 |
-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/py3cairo/+bug/1028115 |
252 |
-Last-Update: 2012-08-20 |
253 |
-Applied-Upstream: http://cgit.freedesktop.org/pycairo/commit/?id=75e82a1b3f495a3abbc78e50a5c66356d320fb15 |
254 |
- |
255 |
---- py3cairo-1.10.0+dfsg.orig/doc/pycairo_c_api.rst |
256 |
-+++ py3cairo-1.10.0+dfsg/doc/pycairo_c_api.rst |
257 |
-@@ -51,6 +51,8 @@ Objects:: |
258 |
- PycairoGradient |
259 |
- PycairoLinearGradient |
260 |
- PycairoRadialGradient |
261 |
-+ PycairoRectangleInt |
262 |
-+ PycairoRegion |
263 |
- PycairoScaledFont |
264 |
- PycairoSurface |
265 |
- PycairoImageSurface |
266 |
-@@ -78,6 +80,8 @@ Types:: |
267 |
- PyTypeObject *Gradient_Type; |
268 |
- PyTypeObject *LinearGradient_Type; |
269 |
- PyTypeObject *RadialGradient_Type; |
270 |
-+ PyTypeObject *RectangleInt_Type; |
271 |
-+ PyTypeObject *Region_Type; |
272 |
- PyTypeObject *ScaledFont_Type; |
273 |
- PyTypeObject *Surface_Type; |
274 |
- PyTypeObject *ImageSurface_Type; |
275 |
-@@ -115,6 +119,12 @@ Functions |
276 |
- .. c:function:: PyObject * PycairoPattern_FromPattern(cairo_pattern_t *pattern, PyObject *base) |
277 |
- |
278 |
- |
279 |
-+.. c:function:: PyObject * PycairoRectangleInt_FromRectangleInt(const cairo_rectangle_int_t *rectangle_int) |
280 |
-+ |
281 |
-+ |
282 |
-+.. c:function:: PyObject * PycairoRegion_FromRegion(const cairo_region_t *region) |
283 |
-+ |
284 |
-+ |
285 |
- .. c:function:: PyObject * PycairoScaledFont_FromScaledFont(cairo_scaled_font_t *scaled_font) |
286 |
- |
287 |
- |
288 |
---- py3cairo-1.10.0+dfsg.orig/doc/reference/index.rst |
289 |
-+++ py3cairo-1.10.0+dfsg/doc/reference/index.rst |
290 |
-@@ -15,5 +15,6 @@ Reference |
291 |
- matrix |
292 |
- paths |
293 |
- patterns |
294 |
-+ region |
295 |
- surfaces |
296 |
- text |
297 |
---- /dev/null |
298 |
-+++ py3cairo-1.10.0+dfsg/doc/reference/region.rst |
299 |
-@@ -0,0 +1,52 @@ |
300 |
-+.. _region: |
301 |
-+ |
302 |
-+****** |
303 |
-+Region |
304 |
-+****** |
305 |
-+Region — Representing a pixel-aligned area |
306 |
-+ |
307 |
-+.. currentmodule:: cairo |
308 |
-+ |
309 |
-+ |
310 |
-+class Region() |
311 |
-+============== |
312 |
-+*Region* is a simple graphical data type representing an area of |
313 |
-+integer-aligned rectangles. They are often used on raster surfaces to track |
314 |
-+areas of interest, such as change or clip areas. |
315 |
-+ |
316 |
-+ |
317 |
-+.. class:: Region([rectangle_int|rectangle_ints]) |
318 |
-+ |
319 |
-+ :param rectangle_int: a rectangle or a list of rectangle |
320 |
-+ :type rectangle_int: :class:`RectangleInt` or [:class:`RectangleInt`] |
321 |
-+ |
322 |
-+ Allocates a new empty region object or a region object with the containing |
323 |
-+ rectangle(s). |
324 |
-+ |
325 |
-+ |
326 |
-+ .. method:: copy() |
327 |
-+ |
328 |
-+ :returns: A newly allocated :class:`Region`. |
329 |
-+ :raises: :exc:`NoMemory` if memory cannot be allocated. |
330 |
-+ |
331 |
-+ Allocates a new *Region* object copying the area from original. |
332 |
-+ |
333 |
-+ |
334 |
-+class RectangleInt() |
335 |
-+==================== |
336 |
-+*RectangleInt* is a data structure for holding a rectangle with integer |
337 |
-+coordinates. |
338 |
-+ |
339 |
-+ |
340 |
-+.. class:: RectangleInt(x=0, y=0, width=0, height=0) |
341 |
-+ |
342 |
-+ :param x: X coordinate of the left side of the rectangle |
343 |
-+ :type x: int |
344 |
-+ :param y: Y coordinate of the the top side of the rectangle |
345 |
-+ :type y: int |
346 |
-+ :param width: width of the rectangle |
347 |
-+ :type width: int |
348 |
-+ :param height: height of the rectangle |
349 |
-+ :type height: int |
350 |
-+ |
351 |
-+ Allocates a new *RectangleInt* object. |
352 |
---- /dev/null |
353 |
-+++ py3cairo-1.10.0+dfsg/src/region.c |
354 |
-@@ -0,0 +1,598 @@ |
355 |
-+/* -*- mode: C; c-basic-offset: 2 -*- |
356 |
-+ * |
357 |
-+ * Copyright © 2005,2010 Steve Chaplin |
358 |
-+ * |
359 |
-+ * This file is part of pycairo. |
360 |
-+ * |
361 |
-+ * Pycairo is free software: you can redistribute it and/or modify it under |
362 |
-+ * the terms of the GNU Lesser General Public License version 3 as published |
363 |
-+ * by the Free Software Foundation. |
364 |
-+ * |
365 |
-+ * Pycairo is distributed in the hope that it will be useful, but WITHOUT ANY |
366 |
-+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
367 |
-+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for |
368 |
-+ * more details. |
369 |
-+ * |
370 |
-+ * You should have received a copy of the GNU Lesser General Public License |
371 |
-+ * along with pycairo. If not, see <http://www.gnu.org/licenses/>. |
372 |
-+ */ |
373 |
-+ |
374 |
-+#define PY_SSIZE_T_CLEAN |
375 |
-+#include <Python.h> |
376 |
-+#include "structmember.h" |
377 |
-+ |
378 |
-+#include "config.h" |
379 |
-+#include "private.h" |
380 |
-+ |
381 |
-+/* PycairoRectangleInt_FromRectangleInt |
382 |
-+ * Create a new PycairoRectangleInt from a cairo_rectangle_int_t |
383 |
-+ * rectangle_int - a cairo_rectangle_int_t to 'wrap' into a Python object. |
384 |
-+ * rectangle_int is unreferenced if the PycairoRectangleInt creation |
385 |
-+ * fails. |
386 |
-+ * Return value: New reference or NULL on failure |
387 |
-+ */ |
388 |
-+PyObject * |
389 |
-+PycairoRectangleInt_FromRectangleInt (cairo_rectangle_int_t *rectangle_int) { |
390 |
-+ PyObject *o; |
391 |
-+ |
392 |
-+ assert (rectangle_int != NULL); |
393 |
-+ |
394 |
-+ o = PycairoRectangleInt_Type.tp_alloc (&PycairoRectangleInt_Type, 0); |
395 |
-+ if (o) |
396 |
-+ ((PycairoRectangleInt *)o)->rectangle_int = *rectangle_int; |
397 |
-+ return o; |
398 |
-+} |
399 |
-+ |
400 |
-+static void |
401 |
-+rectangle_int_dealloc(PycairoRectangleInt *o) { |
402 |
-+#ifdef DEBUG |
403 |
-+ printf("rectangle_int_dealloc start\n"); |
404 |
-+#endif |
405 |
-+ //o->ob_type->tp_free((PyObject *)o); |
406 |
-+ Py_TYPE(o)->tp_free(o); |
407 |
-+#ifdef DEBUG |
408 |
-+ printf("rectangle_int_dealloc end\n"); |
409 |
-+#endif |
410 |
-+} |
411 |
-+ |
412 |
-+static PyObject * |
413 |
-+rectangle_int_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { |
414 |
-+ static char *kwlist[] = { "x", "y", "width", "height", NULL }; |
415 |
-+ int x, y, w, h; |
416 |
-+ x = y = w = h = 0; |
417 |
-+ cairo_rectangle_int_t rect; |
418 |
-+ |
419 |
-+ if (!PyArg_ParseTupleAndKeywords(args, kwds, |
420 |
-+ "|iiii:RectangleInt.__new__", kwlist, |
421 |
-+ &x, &y, &w, &h)) |
422 |
-+ return NULL; |
423 |
-+ |
424 |
-+ rect.x = x; |
425 |
-+ rect.y = y; |
426 |
-+ rect.width = w; |
427 |
-+ rect.height = h; |
428 |
-+ |
429 |
-+ return PycairoRectangleInt_FromRectangleInt(&rect); |
430 |
-+} |
431 |
-+ |
432 |
-+static PyObject * |
433 |
-+rectangle_int_str(PycairoRectangleInt *rect_o) { |
434 |
-+ PyObject *s; |
435 |
-+ cairo_rectangle_int_t *rect = &(rect_o->rectangle_int); |
436 |
-+ char buf[80]; |
437 |
-+ PyOS_snprintf(buf, sizeof(buf), "cairo.RectangleInt(%d, %d, %d, %d)", |
438 |
-+ rect->x, rect->y, rect->width, rect->height); |
439 |
-+ s = PyUnicode_FromString(buf); |
440 |
-+ return s; |
441 |
-+} |
442 |
-+ |
443 |
-+static PyObject * |
444 |
-+rectangle_int_richcompare(PycairoRectangleInt *self, |
445 |
-+ PycairoRectangleInt *other, int op) { |
446 |
-+ int res = 0; |
447 |
-+ PyObject *b; |
448 |
-+ |
449 |
-+ if (op != Py_EQ && op != Py_NE) { |
450 |
-+ PyErr_SetString(PyExc_TypeError, "Only support testing for == or !="); |
451 |
-+ return NULL; |
452 |
-+ } |
453 |
-+ if (!PyObject_IsInstance((PyObject*)other, |
454 |
-+ (PyObject*)&PycairoRectangleInt_Type)) { |
455 |
-+ res = 0; |
456 |
-+ } |
457 |
-+ else if ( |
458 |
-+ self->rectangle_int.x == other->rectangle_int.x && |
459 |
-+ self->rectangle_int.y == other->rectangle_int.y && |
460 |
-+ self->rectangle_int.width == other->rectangle_int.width && |
461 |
-+ self->rectangle_int.height == other->rectangle_int.height |
462 |
-+ ) |
463 |
-+ res = 1; |
464 |
-+ res = op == Py_NE ? !res : res; |
465 |
-+ b = res ? Py_True : Py_False; |
466 |
-+ Py_INCREF(b); |
467 |
-+ |
468 |
-+ return b; |
469 |
-+} |
470 |
-+ |
471 |
-+static PyMemberDef RectangleInt_members[] = { |
472 |
-+ {"x", T_INT, sizeof(PyObject), 0, |
473 |
-+ "X coordinate of the left side of the rectangle"}, |
474 |
-+ {"y", T_INT, sizeof(PyObject)+sizeof(int), 0, |
475 |
-+ "Y coordinate of the the top side of the rectangle"}, |
476 |
-+ {"width", T_INT, sizeof(PyObject)+sizeof(int)*2, 0, |
477 |
-+ "width of the rectangle"}, |
478 |
-+ {"height", T_INT, sizeof(PyObject)+sizeof(int)*3, 0, |
479 |
-+ "height of the rectangle"}, |
480 |
-+ {NULL} |
481 |
-+}; |
482 |
-+ |
483 |
-+PyTypeObject PycairoRectangleInt_Type = { |
484 |
-+ PyVarObject_HEAD_INIT(&PyType_Type, 0) |
485 |
-+ "cairo.RectangleInt", /* tp_name */ |
486 |
-+ sizeof(PycairoRectangleInt), /* tp_basicsize */ |
487 |
-+ 0, /* tp_itemsize */ |
488 |
-+ (destructor)rectangle_int_dealloc, /* tp_dealloc */ |
489 |
-+ 0, /* tp_print */ |
490 |
-+ 0, /* tp_getattr */ |
491 |
-+ 0, /* tp_setattr */ |
492 |
-+ 0, /* tp_compare */ |
493 |
-+ 0, /* tp_repr */ |
494 |
-+ 0, /* tp_as_number */ |
495 |
-+ 0, /* tp_as_sequence */ |
496 |
-+ 0, /* tp_as_mapping */ |
497 |
-+ 0, /* tp_hash */ |
498 |
-+ 0, /* tp_call */ |
499 |
-+ (reprfunc)rectangle_int_str, /* tp_str */ |
500 |
-+ 0, /* tp_getattro */ |
501 |
-+ 0, /* tp_setattro */ |
502 |
-+ 0, /* tp_as_buffer */ |
503 |
-+ Py_TPFLAGS_DEFAULT, /* tp_flags */ |
504 |
-+ 0, /* tp_doc */ |
505 |
-+ 0, /* tp_traverse */ |
506 |
-+ 0, /* tp_clear */ |
507 |
-+ (richcmpfunc)rectangle_int_richcompare, /* tp_richcompare */ |
508 |
-+ 0, /* tp_weaklistoffset */ |
509 |
-+ 0, /* tp_iter */ |
510 |
-+ 0, /* tp_iternext */ |
511 |
-+ 0, /* tp_methods */ |
512 |
-+ RectangleInt_members, /* tp_members */ |
513 |
-+ 0, /* tp_getset */ |
514 |
-+ 0, /* tp_base */ |
515 |
-+ 0, /* tp_dict */ |
516 |
-+ 0, /* tp_descr_get */ |
517 |
-+ 0, /* tp_descr_set */ |
518 |
-+ 0, /* tp_dictoffset */ |
519 |
-+ 0, /* tp_init */ |
520 |
-+ 0, /* tp_alloc */ |
521 |
-+ (newfunc)rectangle_int_new, /* tp_new */ |
522 |
-+}; |
523 |
-+ |
524 |
-+/* PycairoRegion_FromRegion |
525 |
-+ * Create a new PycairoRegion from a cairo_region_t |
526 |
-+ * region - a cairo_region_t to 'wrap' into a Python object. |
527 |
-+ * region is unreferenced if the PycairoRegion creation fails, or if |
528 |
-+ * region is in an error status. |
529 |
-+ * Return value: New reference or NULL on failure |
530 |
-+ */ |
531 |
-+PyObject * |
532 |
-+PycairoRegion_FromRegion (cairo_region_t *region) { |
533 |
-+ PyObject *o; |
534 |
-+ |
535 |
-+ assert (region != NULL); |
536 |
-+ |
537 |
-+ if (Pycairo_Check_Status (cairo_region_status(region))) { |
538 |
-+ cairo_region_destroy (region); |
539 |
-+ return NULL; |
540 |
-+ } |
541 |
-+ |
542 |
-+ o = PycairoRegion_Type.tp_alloc (&PycairoRegion_Type, 0); |
543 |
-+ if (o) |
544 |
-+ ((PycairoRegion *)o)->region = region; |
545 |
-+ else |
546 |
-+ cairo_region_destroy (region); |
547 |
-+ return o; |
548 |
-+} |
549 |
-+ |
550 |
-+static void |
551 |
-+region_dealloc(PycairoRegion *o) { |
552 |
-+#ifdef DEBUG |
553 |
-+ printf("region_dealloc start\n"); |
554 |
-+#endif |
555 |
-+ if (o->region) { |
556 |
-+ cairo_region_destroy(o->region); |
557 |
-+ o->region = NULL; |
558 |
-+ } |
559 |
-+ //o->ob_type->tp_free((PyObject *)o); |
560 |
-+ Py_TYPE(o)->tp_free(o); |
561 |
-+#ifdef DEBUG |
562 |
-+ printf("region_dealloc end\n"); |
563 |
-+#endif |
564 |
-+} |
565 |
-+ |
566 |
-+static PyObject * |
567 |
-+region_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { |
568 |
-+ PyObject *s = NULL; |
569 |
-+ PycairoRectangleInt *rect_obj = NULL; |
570 |
-+ cairo_region_t *region = NULL; |
571 |
-+ cairo_rectangle_int_t *rect = NULL; |
572 |
-+ |
573 |
-+ if (PyArg_ParseTuple(args, "|O!:Region.__new__", |
574 |
-+ &PycairoRectangleInt_Type, &rect_obj)) { |
575 |
-+ if (rect_obj != NULL) { |
576 |
-+ region = cairo_region_create_rectangle(&(rect_obj->rectangle_int)); |
577 |
-+ } |
578 |
-+ } else if (!PyArg_ParseTuple(args, "|O:Region.__new__", &s)) { |
579 |
-+ PyErr_SetString(PyExc_TypeError, |
580 |
-+ "argument must be a RectangleInt or a sequence of RectangleInt."); |
581 |
-+ return NULL; |
582 |
-+ } |
583 |
-+ PyErr_Clear(); /* Clear possible err in the 1st arg parser. */ |
584 |
-+ |
585 |
-+ /* list of rectangle_int or no args */ |
586 |
-+ if (s != NULL) { |
587 |
-+ int i; |
588 |
-+ int rect_size; |
589 |
-+ PyObject *seq = NULL; |
590 |
-+ seq = PySequence_Fast (s, |
591 |
-+ "argument must be a RectangleInt or a sequence of RectangleInt."); |
592 |
-+ if (seq == NULL) { |
593 |
-+ return NULL; |
594 |
-+ } |
595 |
-+ rect_size = PySequence_Fast_GET_SIZE(seq); |
596 |
-+ rect = PyMem_Malloc (rect_size * sizeof(cairo_rectangle_int_t)); |
597 |
-+ if (rect == NULL) { |
598 |
-+ Py_DECREF(seq); |
599 |
-+ return PyErr_NoMemory(); |
600 |
-+ } |
601 |
-+ |
602 |
-+ for(i=0; i<rect_size; i++) { |
603 |
-+ PyObject *obj_tmp = PySequence_Fast_GET_ITEM(seq, i); |
604 |
-+ if (PyObject_IsInstance(obj_tmp, |
605 |
-+ (PyObject*)&PycairoRectangleInt_Type) != 1) { |
606 |
-+ Py_DECREF(seq); |
607 |
-+ PyMem_Free(rect); |
608 |
-+ return NULL; |
609 |
-+ } |
610 |
-+ rect_obj = (PycairoRectangleInt*) obj_tmp; |
611 |
-+ rect[i] = rect_obj->rectangle_int; |
612 |
-+ } |
613 |
-+ |
614 |
-+ region = cairo_region_create_rectangles(rect, rect_size); |
615 |
-+ |
616 |
-+ Py_DECREF(seq); |
617 |
-+ PyMem_Free(rect); |
618 |
-+ } |
619 |
-+ |
620 |
-+ if (region == NULL) { |
621 |
-+ region = cairo_region_create(); |
622 |
-+ } |
623 |
-+ |
624 |
-+ RETURN_NULL_IF_CAIRO_REGION_ERROR(region); |
625 |
-+ return PycairoRegion_FromRegion(region); |
626 |
-+} |
627 |
-+ |
628 |
-+PyObject * |
629 |
-+region_copy (PycairoRegion *o) { |
630 |
-+ cairo_region_t *res; |
631 |
-+ Py_BEGIN_ALLOW_THREADS; |
632 |
-+ res = cairo_region_copy (o->region); |
633 |
-+ Py_END_ALLOW_THREADS; |
634 |
-+ RETURN_NULL_IF_CAIRO_REGION_ERROR(res); |
635 |
-+ return PycairoRegion_FromRegion(res); |
636 |
-+} |
637 |
-+ |
638 |
-+ |
639 |
-+PyObject * |
640 |
-+region_get_extents (PycairoRegion *o) { |
641 |
-+ cairo_rectangle_int_t rect; |
642 |
-+ Py_BEGIN_ALLOW_THREADS; |
643 |
-+ cairo_region_get_extents(o->region, &rect); |
644 |
-+ Py_END_ALLOW_THREADS; |
645 |
-+ |
646 |
-+ return PycairoRectangleInt_FromRectangleInt(&rect); |
647 |
-+} |
648 |
-+ |
649 |
-+ |
650 |
-+PyObject * |
651 |
-+region_num_rectangles (PycairoRegion *o) { |
652 |
-+ int res; |
653 |
-+ Py_BEGIN_ALLOW_THREADS; |
654 |
-+ res = cairo_region_num_rectangles(o->region); |
655 |
-+ Py_END_ALLOW_THREADS; |
656 |
-+ return Py_BuildValue("i", res); |
657 |
-+} |
658 |
-+ |
659 |
-+ |
660 |
-+PyObject * |
661 |
-+region_get_rectangle (PycairoRegion *o, PyObject *args) { |
662 |
-+ cairo_rectangle_int_t rect; |
663 |
-+ int i; |
664 |
-+ int total; |
665 |
-+ if (!PyArg_ParseTuple (args, "i:Region.get_rectangle", &i)) |
666 |
-+ return NULL; |
667 |
-+ total = cairo_region_num_rectangles(o->region); |
668 |
-+ if (i >= total || i < 0) { |
669 |
-+ if ( i < 0) |
670 |
-+ PyErr_SetString(PyExc_ValueError, "index must be a positive number"); |
671 |
-+ else |
672 |
-+ PyErr_SetString(PyExc_ValueError, "index is to big for the region"); |
673 |
-+ return NULL; |
674 |
-+ } |
675 |
-+ Py_BEGIN_ALLOW_THREADS; |
676 |
-+ cairo_region_get_rectangle(o->region, i, &rect); |
677 |
-+ Py_END_ALLOW_THREADS; |
678 |
-+ return PycairoRectangleInt_FromRectangleInt(&rect); |
679 |
-+} |
680 |
-+ |
681 |
-+ |
682 |
-+PyObject * |
683 |
-+region_is_empty (PycairoRegion *o) { |
684 |
-+ cairo_bool_t res; |
685 |
-+ PyObject *b; |
686 |
-+ Py_BEGIN_ALLOW_THREADS; |
687 |
-+ res = cairo_region_is_empty(o->region); |
688 |
-+ Py_END_ALLOW_THREADS; |
689 |
-+ b = res ? Py_True : Py_False; |
690 |
-+ Py_INCREF(b); |
691 |
-+ return b; |
692 |
-+} |
693 |
-+ |
694 |
-+ |
695 |
-+PyObject * |
696 |
-+region_contains_point (PycairoRegion *o, PyObject *args) { |
697 |
-+ int x, y; |
698 |
-+ cairo_bool_t res; |
699 |
-+ PyObject *b; |
700 |
-+ if (!PyArg_ParseTuple (args, "ii:Region.contains_point", &x, &y)) |
701 |
-+ return NULL; |
702 |
-+ Py_BEGIN_ALLOW_THREADS; |
703 |
-+ res = cairo_region_contains_point(o->region, x, y); |
704 |
-+ Py_END_ALLOW_THREADS; |
705 |
-+ b = res ? Py_True : Py_False; |
706 |
-+ Py_INCREF(b); |
707 |
-+ return b; |
708 |
-+} |
709 |
-+ |
710 |
-+ |
711 |
-+PyObject * |
712 |
-+region_contains_rectangle (PycairoRegion *o, PyObject *args) { |
713 |
-+ cairo_region_overlap_t res; |
714 |
-+ PycairoRectangleInt *rect_int; |
715 |
-+ if (!PyArg_ParseTuple (args, "O!:Region.contains_rectangle", |
716 |
-+ &PycairoRectangleInt_Type, &rect_int)) |
717 |
-+ return NULL; |
718 |
-+ Py_BEGIN_ALLOW_THREADS; |
719 |
-+ res = cairo_region_contains_rectangle(o->region, &(rect_int->rectangle_int)); |
720 |
-+ Py_END_ALLOW_THREADS; |
721 |
-+ return Py_BuildValue("i", res); |
722 |
-+} |
723 |
-+ |
724 |
-+ |
725 |
-+PyObject * |
726 |
-+region_equal (PycairoRegion *o, PyObject *args) { |
727 |
-+ cairo_bool_t res; |
728 |
-+ PyObject *b; |
729 |
-+ PycairoRegion *region_obj; |
730 |
-+ if (!PyArg_ParseTuple (args, "O!:Region.equal", |
731 |
-+ &PycairoRegion_Type, ®ion_obj)) |
732 |
-+ return NULL; |
733 |
-+ Py_BEGIN_ALLOW_THREADS; |
734 |
-+ res = cairo_region_equal (o->region, region_obj->region); |
735 |
-+ Py_END_ALLOW_THREADS; |
736 |
-+ b = res ? Py_True : Py_False; |
737 |
-+ Py_INCREF(b); |
738 |
-+ return b; |
739 |
-+} |
740 |
-+ |
741 |
-+static PyObject * |
742 |
-+region_richcompare(PycairoRegion *self, PycairoRegion *other, int op) { |
743 |
-+ int res = 0; |
744 |
-+ PyObject *b; |
745 |
-+ |
746 |
-+ if (op != Py_EQ && op != Py_NE) { |
747 |
-+ PyErr_SetString(PyExc_TypeError, "Only support testing for == or !="); |
748 |
-+ return NULL; |
749 |
-+ } |
750 |
-+ if (!PyObject_IsInstance((PyObject*)other, (PyObject*)&PycairoRegion_Type)) { |
751 |
-+ res = 0; |
752 |
-+ } else { |
753 |
-+ res = cairo_region_equal (self->region, other->region); |
754 |
-+ } |
755 |
-+ |
756 |
-+ res = op == Py_NE ? !res : res; |
757 |
-+ b = res ? Py_True : Py_False; |
758 |
-+ Py_INCREF(b); |
759 |
-+ |
760 |
-+ return b; |
761 |
-+} |
762 |
-+ |
763 |
-+PyObject * |
764 |
-+region_translate (PycairoRegion *o, PyObject *args) { |
765 |
-+ int x, y; |
766 |
-+ if (!PyArg_ParseTuple (args, "ii:Region.translate", &x, &y)) |
767 |
-+ return NULL; |
768 |
-+ Py_BEGIN_ALLOW_THREADS; |
769 |
-+ cairo_region_translate (o->region, x, y); |
770 |
-+ Py_END_ALLOW_THREADS; |
771 |
-+ Py_RETURN_NONE; |
772 |
-+} |
773 |
-+ |
774 |
-+ |
775 |
-+PyObject * |
776 |
-+region_intersect (PycairoRegion *o, PyObject *args) { |
777 |
-+ cairo_status_t res; |
778 |
-+ PyObject *other; |
779 |
-+ if (!PyArg_ParseTuple (args, "O:Region.intersect", &other)) |
780 |
-+ return NULL; |
781 |
-+ |
782 |
-+ if (PyObject_IsInstance(other, (PyObject*)&PycairoRegion_Type) == 1) { |
783 |
-+ Py_BEGIN_ALLOW_THREADS; |
784 |
-+ res = cairo_region_intersect(o->region, |
785 |
-+ ((PycairoRegion *)other)->region); |
786 |
-+ Py_END_ALLOW_THREADS; |
787 |
-+ } else if (PyObject_IsInstance(other, |
788 |
-+ (PyObject*)&PycairoRectangleInt_Type) == 1) { |
789 |
-+ Py_BEGIN_ALLOW_THREADS; |
790 |
-+ res = cairo_region_intersect_rectangle(o->region, |
791 |
-+ &(((PycairoRectangleInt *)other)->rectangle_int)); |
792 |
-+ Py_END_ALLOW_THREADS; |
793 |
-+ } else { |
794 |
-+ PyErr_SetString(PyExc_TypeError, |
795 |
-+ "argument must be a Region or a RectangleInt."); |
796 |
-+ return NULL; |
797 |
-+ } |
798 |
-+ |
799 |
-+ RETURN_NULL_IF_CAIRO_ERROR(res); |
800 |
-+ Py_RETURN_NONE; |
801 |
-+} |
802 |
-+ |
803 |
-+PyObject * |
804 |
-+region_subtract (PycairoRegion *o, PyObject *args) { |
805 |
-+ cairo_status_t res; |
806 |
-+ PyObject *other; |
807 |
-+ if (!PyArg_ParseTuple (args, "O:Region.subtract", &other)) |
808 |
-+ return NULL; |
809 |
-+ |
810 |
-+ if (PyObject_IsInstance(other, (PyObject*)&PycairoRegion_Type) == 1) { |
811 |
-+ Py_BEGIN_ALLOW_THREADS; |
812 |
-+ res = cairo_region_subtract(o->region, |
813 |
-+ ((PycairoRegion *)other)->region); |
814 |
-+ Py_END_ALLOW_THREADS; |
815 |
-+ } else if (PyObject_IsInstance(other, |
816 |
-+ (PyObject*)&PycairoRectangleInt_Type) == 1) { |
817 |
-+ Py_BEGIN_ALLOW_THREADS; |
818 |
-+ res = cairo_region_subtract_rectangle(o->region, |
819 |
-+ &(((PycairoRectangleInt *)other)->rectangle_int)); |
820 |
-+ Py_END_ALLOW_THREADS; |
821 |
-+ } else { |
822 |
-+ PyErr_SetString(PyExc_TypeError, |
823 |
-+ "argument must be a Region or a RectangleInt."); |
824 |
-+ return NULL; |
825 |
-+ } |
826 |
-+ RETURN_NULL_IF_CAIRO_ERROR(res); |
827 |
-+ Py_RETURN_NONE; |
828 |
-+} |
829 |
-+ |
830 |
-+PyObject * |
831 |
-+region_union (PycairoRegion *o, PyObject *args) { |
832 |
-+ cairo_status_t res; |
833 |
-+ PyObject *other; |
834 |
-+ if (!PyArg_ParseTuple (args, "O:Region.union", &other)) |
835 |
-+ return NULL; |
836 |
-+ |
837 |
-+ if (PyObject_IsInstance(other, (PyObject*)&PycairoRegion_Type) == 1) { |
838 |
-+ Py_BEGIN_ALLOW_THREADS; |
839 |
-+ res = cairo_region_union(o->region, |
840 |
-+ ((PycairoRegion *)other)->region); |
841 |
-+ Py_END_ALLOW_THREADS; |
842 |
-+ } else if (PyObject_IsInstance(other, |
843 |
-+ (PyObject*)&PycairoRectangleInt_Type) == 1) { |
844 |
-+ Py_BEGIN_ALLOW_THREADS; |
845 |
-+ res = cairo_region_union_rectangle(o->region, |
846 |
-+ &(((PycairoRectangleInt *)other)->rectangle_int)); |
847 |
-+ Py_END_ALLOW_THREADS; |
848 |
-+ } else { |
849 |
-+ PyErr_SetString(PyExc_TypeError, |
850 |
-+ "argument must be a Region or a RectangleInt."); |
851 |
-+ return NULL; |
852 |
-+ } |
853 |
-+ RETURN_NULL_IF_CAIRO_ERROR(res); |
854 |
-+ Py_RETURN_NONE; |
855 |
-+} |
856 |
-+ |
857 |
-+PyObject * |
858 |
-+region_xor (PycairoRegion *o, PyObject *args) { |
859 |
-+ cairo_status_t res; |
860 |
-+ PyObject *other; |
861 |
-+ if (!PyArg_ParseTuple (args, "O:Region.xorg", &other)) |
862 |
-+ return NULL; |
863 |
-+ |
864 |
-+ if (PyObject_IsInstance(other, (PyObject*)&PycairoRegion_Type) == 1) { |
865 |
-+ Py_BEGIN_ALLOW_THREADS; |
866 |
-+ res = cairo_region_xor(o->region, |
867 |
-+ ((PycairoRegion *)other)->region); |
868 |
-+ Py_END_ALLOW_THREADS; |
869 |
-+ } else if (PyObject_IsInstance(other, |
870 |
-+ (PyObject*)&PycairoRectangleInt_Type) == 1) { |
871 |
-+ Py_BEGIN_ALLOW_THREADS; |
872 |
-+ res = cairo_region_xor_rectangle(o->region, |
873 |
-+ &(((PycairoRectangleInt *)other)->rectangle_int)); |
874 |
-+ Py_END_ALLOW_THREADS; |
875 |
-+ } else { |
876 |
-+ PyErr_SetString(PyExc_TypeError, |
877 |
-+ "argument must be a Region or a RectangleInt."); |
878 |
-+ return NULL; |
879 |
-+ } |
880 |
-+ RETURN_NULL_IF_CAIRO_ERROR(res); |
881 |
-+ Py_RETURN_NONE; |
882 |
-+} |
883 |
-+ |
884 |
-+static PyMethodDef region_methods[] = { |
885 |
-+ /* methods never exposed in a language binding: |
886 |
-+ * cairo_region_destroy() |
887 |
-+ * cairo_region_get_type() |
888 |
-+ * cairo_region_reference() |
889 |
-+ * |
890 |
-+ * cairo_region_status() |
891 |
-+ * - not needed since Pycairo handles status checking |
892 |
-+ * |
893 |
-+ * _(intersect/subtract/union/xor)_rectangle are merged with the region |
894 |
-+ * ones. |
895 |
-+ */ |
896 |
-+ {"copy", (PyCFunction)region_copy, METH_NOARGS }, |
897 |
-+ {"get_extents", (PyCFunction)region_get_extents, METH_NOARGS }, |
898 |
-+ {"num_rectangles", (PyCFunction)region_num_rectangles, METH_NOARGS }, |
899 |
-+ {"get_rectangle", (PyCFunction)region_get_rectangle, METH_VARARGS }, |
900 |
-+ {"is_empty", (PyCFunction)region_is_empty, METH_NOARGS }, |
901 |
-+ {"contains_point", (PyCFunction)region_contains_point, METH_VARARGS }, |
902 |
-+ {"contains_rectangle", (PyCFunction)region_contains_rectangle, |
903 |
-+ METH_VARARGS }, |
904 |
-+ {"equal", (PyCFunction)region_equal, METH_VARARGS }, |
905 |
-+ {"translate", (PyCFunction)region_translate, METH_VARARGS }, |
906 |
-+ {"intersect", (PyCFunction)region_intersect, METH_VARARGS }, |
907 |
-+ {"subtract", (PyCFunction)region_subtract, METH_VARARGS }, |
908 |
-+ {"union", (PyCFunction)region_union, METH_VARARGS }, |
909 |
-+ {"xor", (PyCFunction)region_xor, METH_VARARGS }, |
910 |
-+ {NULL, NULL, 0, NULL}, |
911 |
-+}; |
912 |
-+ |
913 |
-+PyTypeObject PycairoRegion_Type = { |
914 |
-+ PyVarObject_HEAD_INIT(&PyType_Type, 0) |
915 |
-+ "cairo.Region", /* tp_name */ |
916 |
-+ sizeof(PycairoRegion), /* tp_basicsize */ |
917 |
-+ 0, /* tp_itemsize */ |
918 |
-+ (destructor)region_dealloc, /* tp_dealloc */ |
919 |
-+ 0, /* tp_print */ |
920 |
-+ 0, /* tp_getattr */ |
921 |
-+ 0, /* tp_setattr */ |
922 |
-+ 0, /* tp_compare */ |
923 |
-+ 0, /* tp_repr */ |
924 |
-+ 0, /* tp_as_number */ |
925 |
-+ 0, /* tp_as_sequence */ |
926 |
-+ 0, /* tp_as_mapping */ |
927 |
-+ 0, /* tp_hash */ |
928 |
-+ 0, /* tp_call */ |
929 |
-+ 0, /* tp_str */ |
930 |
-+ 0, /* tp_getattro */ |
931 |
-+ 0, /* tp_setattro */ |
932 |
-+ 0, /* tp_as_buffer */ |
933 |
-+ Py_TPFLAGS_DEFAULT, /* tp_flags */ |
934 |
-+ 0, /* tp_doc */ |
935 |
-+ 0, /* tp_traverse */ |
936 |
-+ 0, /* tp_clear */ |
937 |
-+ (richcmpfunc)region_richcompare, /* tp_richcompare */ |
938 |
-+ 0, /* tp_weaklistoffset */ |
939 |
-+ 0, /* tp_iter */ |
940 |
-+ 0, /* tp_iternext */ |
941 |
-+ region_methods, /* tp_methods */ |
942 |
-+ 0, /* tp_members */ |
943 |
-+ 0, /* tp_getset */ |
944 |
-+ 0, /* tp_base */ |
945 |
-+ 0, /* tp_dict */ |
946 |
-+ 0, /* tp_descr_get */ |
947 |
-+ 0, /* tp_descr_set */ |
948 |
-+ 0, /* tp_dictoffset */ |
949 |
-+ 0, /* tp_init */ |
950 |
-+ 0, /* tp_alloc */ |
951 |
-+ (newfunc)region_new, /* tp_new */ |
952 |
-+}; |
953 |
---- py3cairo-1.10.0+dfsg.orig/src/py3cairo.h |
954 |
-+++ py3cairo-1.10.0+dfsg/src/py3cairo.h |
955 |
-@@ -67,6 +67,16 @@ typedef struct { |
956 |
- |
957 |
- typedef struct { |
958 |
- PyObject_HEAD |
959 |
-+ cairo_rectangle_int_t rectangle_int; |
960 |
-+} PycairoRectangleInt; |
961 |
-+ |
962 |
-+typedef struct { |
963 |
-+ PyObject_HEAD |
964 |
-+ cairo_region_t *region; |
965 |
-+} PycairoRegion; |
966 |
-+ |
967 |
-+typedef struct { |
968 |
-+ PyObject_HEAD |
969 |
- cairo_scaled_font_t *scaled_font; |
970 |
- } PycairoScaledFont; |
971 |
- |
972 |
-@@ -129,6 +139,14 @@ typedef struct { |
973 |
- |
974 |
- /* misc functions */ |
975 |
- int (*Check_Status)(cairo_status_t status); |
976 |
-+ |
977 |
-+ PyTypeObject *RectangleInt_Type; |
978 |
-+ PyObject *(*RectangleInt_FromRectangleInt)( |
979 |
-+ const cairo_rectangle_int_t *rectangle_int); |
980 |
-+ |
981 |
-+ PyTypeObject *Region_Type; |
982 |
-+ PyObject *(*Region_FromRegion)(const cairo_region_t *region); |
983 |
-+ |
984 |
- } Pycairo_CAPI_t; |
985 |
- |
986 |
- |
987 |
-@@ -156,6 +174,13 @@ typedef struct { |
988 |
- #define PycairoRadialGradient_Type *(Pycairo_CAPI->RadialGradient_Type) |
989 |
- #define PycairoPattern_FromPattern (Pycairo_CAPI->Pattern_FromPattern) |
990 |
- |
991 |
-+#define PycairoRectangleInt_Type *(Pycairo_CAPI->RectangleInt_Type) |
992 |
-+#define PycairoRectangleInt_FromRectangleInt \ |
993 |
-+ (Pycairo_CAPI->RectangleInt_FromRectangleInt) |
994 |
-+ |
995 |
-+#define PycairoRegion_Type *(Pycairo_CAPI->Region_Type) |
996 |
-+#define PycairoRegion_FromRegion (Pycairo_CAPI->Region_FromRegion) |
997 |
-+ |
998 |
- #define PycairoScaledFont_Type *(Pycairo_CAPI->ScaledFont_Type) |
999 |
- #define PycairoScaledFont_FromScaledFont \ |
1000 |
- (Pycairo_CAPI->ScaledFont_FromScaledFont) |
1001 |
---- py3cairo-1.10.0+dfsg.orig/src/cairomodule.c |
1002 |
-+++ py3cairo-1.10.0+dfsg/src/cairomodule.c |
1003 |
-@@ -141,6 +141,12 @@ static Pycairo_CAPI_t CAPI = { |
1004 |
- PycairoSurface_FromSurface, |
1005 |
- |
1006 |
- Pycairo_Check_Status, |
1007 |
-+ |
1008 |
-+ &PycairoRectangleInt_Type, |
1009 |
-+ PycairoRectangleInt_FromRectangleInt, |
1010 |
-+ |
1011 |
-+ &PycairoRegion_Type, |
1012 |
-+ PycairoRegion_FromRegion, |
1013 |
- }; |
1014 |
- |
1015 |
- static PyObject * |
1016 |
-@@ -230,6 +236,12 @@ PyInit__cairo(void) |
1017 |
- if (PyType_Ready(&PycairoRadialGradient_Type) < 0) |
1018 |
- return NULL; |
1019 |
- |
1020 |
-+ if (PyType_Ready(&PycairoRectangleInt_Type) < 0) |
1021 |
-+ return NULL; |
1022 |
-+ |
1023 |
-+ if (PyType_Ready(&PycairoRegion_Type) < 0) |
1024 |
-+ return NULL; |
1025 |
-+ |
1026 |
- if (PyType_Ready(&PycairoScaledFont_Type) < 0) |
1027 |
- return NULL; |
1028 |
- |
1029 |
-@@ -315,6 +327,12 @@ PyInit__cairo(void) |
1030 |
- PyModule_AddObject(m, "RadialGradient", |
1031 |
- (PyObject *)&PycairoRadialGradient_Type); |
1032 |
- |
1033 |
-+ Py_INCREF(&PycairoRectangleInt_Type); |
1034 |
-+ PyModule_AddObject(m, "RectangleInt", (PyObject *)&PycairoRectangleInt_Type); |
1035 |
-+ |
1036 |
-+ Py_INCREF(&PycairoRegion_Type); |
1037 |
-+ PyModule_AddObject(m, "Region", (PyObject *)&PycairoRegion_Type); |
1038 |
-+ |
1039 |
- Py_INCREF(&PycairoScaledFont_Type); |
1040 |
- PyModule_AddObject(m, "ScaledFont", (PyObject *)&PycairoScaledFont_Type); |
1041 |
- |
1042 |
-@@ -519,6 +537,10 @@ PyInit__cairo(void) |
1043 |
- CONSTANT(PS_LEVEL_3); |
1044 |
- #endif |
1045 |
- |
1046 |
-+ CONSTANT(REGION_OVERLAP_IN); |
1047 |
-+ CONSTANT(REGION_OVERLAP_OUT); |
1048 |
-+ CONSTANT(REGION_OVERLAP_PART); |
1049 |
-+ |
1050 |
- CONSTANT(SUBPIXEL_ORDER_DEFAULT); |
1051 |
- CONSTANT(SUBPIXEL_ORDER_RGB); |
1052 |
- CONSTANT(SUBPIXEL_ORDER_BGR); |
1053 |
---- py3cairo-1.10.0+dfsg.orig/src/wscript |
1054 |
-+++ py3cairo-1.10.0+dfsg/src/wscript |
1055 |
-@@ -25,6 +25,7 @@ def build(ctx): |
1056 |
- 'font.c', |
1057 |
- 'path.c', |
1058 |
- 'pattern.c', |
1059 |
-+ 'region.c', |
1060 |
- 'matrix.c', |
1061 |
- 'surface.c', |
1062 |
- ], |
1063 |
---- py3cairo-1.10.0+dfsg.orig/src/private.h |
1064 |
-+++ py3cairo-1.10.0+dfsg/src/private.h |
1065 |
-@@ -60,6 +60,13 @@ extern PyTypeObject PycairoLinearGradien |
1066 |
- extern PyTypeObject PycairoRadialGradient_Type; |
1067 |
- PyObject *PycairoPattern_FromPattern (cairo_pattern_t *pattern, |
1068 |
- PyObject *base); |
1069 |
-+ |
1070 |
-+extern PyTypeObject PycairoRectangleInt_Type; |
1071 |
-+PyObject *PycairoRectangleInt_FromRectangleInt ( |
1072 |
-+ cairo_rectangle_int_t *rectangle_int); |
1073 |
-+ |
1074 |
-+extern PyTypeObject PycairoRegion_Type; |
1075 |
-+PyObject *PycairoRegion_FromRegion (cairo_region_t *region); |
1076 |
- |
1077 |
- extern PyTypeObject PycairoScaledFont_Type; |
1078 |
- PyObject *PycairoScaledFont_FromScaledFont (cairo_scaled_font_t *scaled_font); |
1079 |
-@@ -153,6 +160,15 @@ int Pycairo_Check_Status (cairo_status_t |
1080 |
- if (status != CAIRO_STATUS_SUCCESS) { \ |
1081 |
- Pycairo_Check_Status (status); \ |
1082 |
- return NULL; \ |
1083 |
-+ } \ |
1084 |
-+ } while (0) |
1085 |
-+ |
1086 |
-+#define RETURN_NULL_IF_CAIRO_REGION_ERROR(region) \ |
1087 |
-+ do { \ |
1088 |
-+ cairo_status_t status = cairo_region_status (region); \ |
1089 |
-+ if (status != CAIRO_STATUS_SUCCESS) { \ |
1090 |
-+ Pycairo_Check_Status (status); \ |
1091 |
-+ return NULL; \ |
1092 |
- } \ |
1093 |
- } while (0) |
1094 |
- |
1095 |
---- py3cairo-1.10.0+dfsg.orig/test/api_test.py |
1096 |
-+++ py3cairo-1.10.0+dfsg/test/api_test.py |
1097 |
-@@ -84,3 +84,65 @@ def test_surface(): |
1098 |
- |
1099 |
- def test_text(): |
1100 |
- pass |
1101 |
-+ |
1102 |
-+ |
1103 |
-+def test_region(): |
1104 |
-+ a = cairo.Region() |
1105 |
-+ assert a.is_empty() == True |
1106 |
-+ assert a.num_rectangles() == 0 |
1107 |
-+ |
1108 |
-+ b = cairo.RectangleInt(1, 2, 10, 12) |
1109 |
-+ d = cairo.RectangleInt(1, 1, 10, 12) |
1110 |
-+ e = cairo.RectangleInt(1, 3, 8, 12) |
1111 |
-+ assert (b.x, b.y, b.width, b.height) == (1, 2, 10, 12) |
1112 |
-+ c = cairo.Region((b, e)) |
1113 |
-+ assert not c.is_empty() |
1114 |
-+ assert c.num_rectangles() == 2 |
1115 |
-+ assert c.get_rectangle(1).y == 14 |
1116 |
-+ |
1117 |
-+ ex = c.get_extents() |
1118 |
-+ assert ex == cairo.RectangleInt(1, 2, 10, 13) |
1119 |
-+ assert c.contains_rectangle(d) == cairo.REGION_OVERLAP_PART |
1120 |
-+ |
1121 |
-+ c.translate(10, 20) |
1122 |
-+ assert c.contains_rectangle(d) == cairo.REGION_OVERLAP_OUT |
1123 |
-+ assert c.get_rectangle(1) == cairo.RectangleInt(11, 34, 8, 1) |
1124 |
-+ |
1125 |
-+ cp = c.copy() |
1126 |
-+ assert c.num_rectangles() == cp.num_rectangles() |
1127 |
-+ assert c.get_rectangle(0) == cp.get_rectangle(0) |
1128 |
-+ assert c == cp |
1129 |
-+ assert 3 != c |
1130 |
-+ assert c != "test" |
1131 |
-+ |
1132 |
-+ c = cairo.Region((b, e)) |
1133 |
-+ c.intersect(d) |
1134 |
-+ assert c.num_rectangles() == 1 |
1135 |
-+ assert c.get_rectangle(0) == cairo.RectangleInt(1, 2, 10, 11) |
1136 |
-+ |
1137 |
-+ c = cairo.Region((b, e)) |
1138 |
-+ c.subtract(d) |
1139 |
-+ assert c.num_rectangles() == 2 |
1140 |
-+ assert c == cairo.Region([ |
1141 |
-+ cairo.RectangleInt(1, 13, 10, 1), cairo.RectangleInt(1, 14, 8, 1) ]) |
1142 |
-+ |
1143 |
-+ d = cairo.Region(d) |
1144 |
-+ c = cairo.Region((b, e)) |
1145 |
-+ c.subtract(d) |
1146 |
-+ assert c.num_rectangles() == 2 |
1147 |
-+ assert c.get_rectangle(0) == cairo.RectangleInt(1, 13, 10, 1) |
1148 |
-+ |
1149 |
-+ c = cairo.Region((b, e)) |
1150 |
-+ c.union(d) |
1151 |
-+ assert c.num_rectangles() == 2 |
1152 |
-+ assert c == cairo.Region([ |
1153 |
-+ cairo.RectangleInt(1, 1, 10, 13), cairo.RectangleInt(1, 14, 8, 1) ]) |
1154 |
-+ |
1155 |
-+ c = cairo.Region((b, e)) |
1156 |
-+ c.xor(d) |
1157 |
-+ assert c.num_rectangles() == 3 |
1158 |
-+ assert c == cairo.Region([ |
1159 |
-+ cairo.RectangleInt(1, 1, 10, 1), |
1160 |
-+ cairo.RectangleInt(1, 14, 8, 1), |
1161 |
-+ cairo.RectangleInt(1, 13, 10, 1), |
1162 |
-+ ]) |
1163 |
|
1164 |
diff --git a/dev-python/pycairo/files/pycairo-1.10.0-50_specify-encoding-in-waf.patch b/dev-python/pycairo/files/pycairo-1.10.0-50_specify-encoding-in-waf.patch |
1165 |
deleted file mode 100644 |
1166 |
index 5356554e75f..00000000000 |
1167 |
--- a/dev-python/pycairo/files/pycairo-1.10.0-50_specify-encoding-in-waf.patch |
1168 |
+++ /dev/null |
1169 |
@@ -1,32 +0,0 @@ |
1170 |
-Description: specify encoding in waf |
1171 |
- This patch specifies utf-8 as the encoding in waf library, because python 3.3 |
1172 |
- doesn't fallback to utf-8 on default. |
1173 |
-Author: Matthias Klose <doko@××××××.com> |
1174 |
-Origin: http://launchpadlibrarian.net/120606963/py3cairo_1.10.0%2Bdfsg-3~exp2_1.10.0%2Bdfsg-3~exp2ubuntu1.diff.gz |
1175 |
-Bug-Debian: http://bugs.debian.org/691241 |
1176 |
-Last-Update: 2012-10-28 |
1177 |
- |
1178 |
---- py3cairo-1.10.0+dfsg.orig/waflib/Utils.py |
1179 |
-+++ py3cairo-1.10.0+dfsg/waflib/Utils.py |
1180 |
-@@ -77,8 +77,8 @@ except ImportError: |
1181 |
- return value |
1182 |
- is_win32=sys.platform=='win32' |
1183 |
- indicator=is_win32 and'\x1b[A\x1b[K%s%s%s\r'or'\x1b[K%s%s%s\r' |
1184 |
--def readf(fname,m='r'): |
1185 |
-- f=open(fname,m) |
1186 |
-+def readf(fname,m='r',enc=None): |
1187 |
-+ f=open(fname,m,encoding=enc) |
1188 |
- try: |
1189 |
- txt=f.read() |
1190 |
- finally: |
1191 |
---- py3cairo-1.10.0+dfsg.orig/waflib/Tools/c_preproc.py |
1192 |
-+++ py3cairo-1.10.0+dfsg/waflib/Tools/c_preproc.py |
1193 |
-@@ -44,7 +44,7 @@ def repl(m): |
1194 |
- return' ' |
1195 |
- return m.group(3)or'' |
1196 |
- def filter_comments(filename): |
1197 |
-- code=Utils.readf(filename) |
1198 |
-+ code=Utils.readf(filename, enc='utf-8') |
1199 |
- if use_trigraphs: |
1200 |
- for(a,b)in trig_def:code=code.split(a).join(b) |
1201 |
- code=re_nl.sub('',code) |
1202 |
|
1203 |
diff --git a/dev-python/pycairo/files/pycairo-1.10.0-80_fix-pickle.patch b/dev-python/pycairo/files/pycairo-1.10.0-80_fix-pickle.patch |
1204 |
deleted file mode 100644 |
1205 |
index 3e0cdc3e61f..00000000000 |
1206 |
--- a/dev-python/pycairo/files/pycairo-1.10.0-80_fix-pickle.patch |
1207 |
+++ /dev/null |
1208 |
@@ -1,30 +0,0 @@ |
1209 |
-Description: During the build process, a Context instance is pickled, or at |
1210 |
- least attempted to be. This fails because self.node_class is assigned to a |
1211 |
- class which is nested inside the __init__() method. Because Python cannot |
1212 |
- find this class at unpickling time (i.e. it cannot be imported), Python |
1213 |
- refuses to pickle the Context instance, leading to a FTBFS. Since there's no |
1214 |
- obvious reason why the class has to be so nested, moving it to a module |
1215 |
- global solves the build failure. |
1216 |
-Author: Barry Warsaw <barry@××××××.org> |
1217 |
-Bug: https://bugs.freedesktop.org/show_bug.cgi?id=91561 |
1218 |
- |
1219 |
---- a/waflib/Context.py |
1220 |
-+++ b/waflib/Context.py |
1221 |
-@@ -51,6 +51,8 @@ |
1222 |
- global classes |
1223 |
- classes.insert(0,cls) |
1224 |
- ctx=store_context('ctx',(object,),{}) |
1225 |
-+class node_class(waflib.Node.Node): |
1226 |
-+ pass |
1227 |
- class Context(ctx): |
1228 |
- errors=Errors |
1229 |
- tools={} |
1230 |
-@@ -60,8 +62,6 @@ |
1231 |
- except KeyError: |
1232 |
- global run_dir |
1233 |
- rd=run_dir |
1234 |
-- class node_class(waflib.Node.Node): |
1235 |
-- pass |
1236 |
- self.node_class=node_class |
1237 |
- self.node_class.__module__="waflib.Node" |
1238 |
- self.node_class.__name__="Nod3" |
1239 |
|
1240 |
diff --git a/dev-python/pycairo/files/pycairo-1.10.0-81_pickling-again.patch b/dev-python/pycairo/files/pycairo-1.10.0-81_pickling-again.patch |
1241 |
deleted file mode 100644 |
1242 |
index 3aad32593b3..00000000000 |
1243 |
--- a/dev-python/pycairo/files/pycairo-1.10.0-81_pickling-again.patch |
1244 |
+++ /dev/null |
1245 |
@@ -1,37 +0,0 @@ |
1246 |
-Description: Follow up to 80_fix-pickle.patch. Just disable pickling |
1247 |
- altogether since the previous patch doesn't really fix the problem, and not |
1248 |
- storing the pickle seems to have no adverse effects on the build, while |
1249 |
- avoiding the observed traceback. |
1250 |
-Author: Barry Warsaw <barry@××××××.org> |
1251 |
-Forwarded: no |
1252 |
- |
1253 |
---- a/waflib/Build.py |
1254 |
-+++ b/waflib/Build.py |
1255 |
-@@ -151,6 +151,7 @@ |
1256 |
- f.close() |
1257 |
- self.init_dirs() |
1258 |
- def store(self): |
1259 |
-+ return |
1260 |
- data={} |
1261 |
- for x in SAVED_ATTRS: |
1262 |
- data[x]=getattr(self,x) |
1263 |
---- a/waflib/Context.py |
1264 |
-+++ b/waflib/Context.py |
1265 |
-@@ -51,8 +51,6 @@ |
1266 |
- global classes |
1267 |
- classes.insert(0,cls) |
1268 |
- ctx=store_context('ctx',(object,),{}) |
1269 |
--class node_class(waflib.Node.Node): |
1270 |
-- pass |
1271 |
- class Context(ctx): |
1272 |
- errors=Errors |
1273 |
- tools={} |
1274 |
-@@ -62,6 +60,8 @@ |
1275 |
- except KeyError: |
1276 |
- global run_dir |
1277 |
- rd=run_dir |
1278 |
-+ class node_class(waflib.Node.Node): |
1279 |
-+ pass |
1280 |
- self.node_class=node_class |
1281 |
- self.node_class.__module__="waflib.Node" |
1282 |
- self.node_class.__name__="Nod3" |
1283 |
|
1284 |
diff --git a/dev-python/pycairo/files/pycairo-1.10.0-svg_check.patch b/dev-python/pycairo/files/pycairo-1.10.0-svg_check.patch |
1285 |
deleted file mode 100644 |
1286 |
index 572a5f6cc71..00000000000 |
1287 |
--- a/dev-python/pycairo/files/pycairo-1.10.0-svg_check.patch |
1288 |
+++ /dev/null |
1289 |
@@ -1,126 +0,0 @@ |
1290 |
---- src/cairomodule.c |
1291 |
-+++ src/cairomodule.c |
1292 |
-@@ -116,7 +116,7 @@ |
1293 |
- #else |
1294 |
- 0, |
1295 |
- #endif |
1296 |
--#ifdef CAIRO_HAS_SVG_SURFACE |
1297 |
-+#ifdef PYCAIRO_ENABLE_SVG |
1298 |
- &PycairoSVGSurface_Type, |
1299 |
- #else |
1300 |
- 0, |
1301 |
-@@ -247,7 +247,7 @@ |
1302 |
- if (PyType_Ready(&PycairoPSSurface_Type) < 0) |
1303 |
- return NULL; |
1304 |
- #endif |
1305 |
--#ifdef CAIRO_HAS_SVG_SURFACE |
1306 |
-+#ifdef PYCAIRO_ENABLE_SVG |
1307 |
- if (PyType_Ready(&PycairoSVGSurface_Type) < 0) |
1308 |
- return NULL; |
1309 |
- #endif |
1310 |
-@@ -337,7 +337,7 @@ |
1311 |
- PyModule_AddObject(m, "PSSurface", (PyObject *)&PycairoPSSurface_Type); |
1312 |
- #endif |
1313 |
- |
1314 |
--#ifdef CAIRO_HAS_SVG_SURFACE |
1315 |
-+#ifdef PYCAIRO_ENABLE_SVG |
1316 |
- Py_INCREF(&PycairoSVGSurface_Type); |
1317 |
- PyModule_AddObject(m, "SVGSurface", (PyObject *)&PycairoSVGSurface_Type); |
1318 |
- #endif |
1319 |
-@@ -399,7 +399,7 @@ |
1320 |
- #else |
1321 |
- PyModule_AddIntConstant(m, "HAS_PS_SURFACE", 0); |
1322 |
- #endif |
1323 |
--#if CAIRO_HAS_SVG_SURFACE |
1324 |
-+#if PYCAIRO_ENABLE_SVG |
1325 |
- PyModule_AddIntConstant(m, "HAS_SVG_SURFACE", 1); |
1326 |
- #else |
1327 |
- PyModule_AddIntConstant(m, "HAS_SVG_SURFACE", 0); |
1328 |
---- src/private.h |
1329 |
-+++ src/private.h |
1330 |
-@@ -75,7 +75,7 @@ |
1331 |
- extern PyTypeObject PycairoPSSurface_Type; |
1332 |
- #endif |
1333 |
- |
1334 |
--#if CAIRO_HAS_SVG_SURFACE |
1335 |
-+#if PYCAIRO_ENABLE_SVG |
1336 |
- extern PyTypeObject PycairoSVGSurface_Type; |
1337 |
- #endif |
1338 |
- |
1339 |
---- src/py3cairo.h |
1340 |
-+++ src/py3cairo.h |
1341 |
-@@ -171,7 +171,7 @@ |
1342 |
- #define PycairoPSSurface_Type *(Pycairo_CAPI->PSSurface_Type) |
1343 |
- #endif |
1344 |
- |
1345 |
--#if CAIRO_HAS_SVG_SURFACE |
1346 |
-+#if PYCAIRO_ENABLE_SVG |
1347 |
- #define PycairoSVGSurface_Type *(Pycairo_CAPI->SVGSurface_Type) |
1348 |
- #endif |
1349 |
- |
1350 |
---- src/surface.c |
1351 |
-+++ src/surface.c |
1352 |
-@@ -72,7 +72,7 @@ |
1353 |
- type = &PycairoPSSurface_Type; |
1354 |
- break; |
1355 |
- #endif |
1356 |
--#if CAIRO_HAS_SVG_SURFACE |
1357 |
-+#if PYCAIRO_ENABLE_SVG |
1358 |
- case CAIRO_SURFACE_TYPE_SVG: |
1359 |
- type = &PycairoSVGSurface_Type; |
1360 |
- break; |
1361 |
-@@ -1022,7 +1022,7 @@ |
1362 |
- |
1363 |
- |
1364 |
- /* Class SVGSurface(Surface) ----------------------------------------------- */ |
1365 |
--#ifdef CAIRO_HAS_SVG_SURFACE |
1366 |
-+#ifdef PYCAIRO_ENABLE_SVG |
1367 |
- #include <cairo-svg.h> |
1368 |
- |
1369 |
- static PyObject * |
1370 |
-@@ -1133,7 +1133,7 @@ |
1371 |
- 0, /* tp_is_gc */ |
1372 |
- 0, /* tp_bases */ |
1373 |
- }; |
1374 |
--#endif /* CAIRO_HAS_SVG_SURFACE */ |
1375 |
-+#endif /* PYCAIRO_ENABLE_SVG */ |
1376 |
- |
1377 |
- |
1378 |
- #if CAIRO_HAS_WIN32_SURFACE |
1379 |
---- wscript |
1380 |
-+++ wscript |
1381 |
-@@ -1,6 +1,7 @@ |
1382 |
- # -*- python -*- |
1383 |
- |
1384 |
- import os |
1385 |
-+import subprocess |
1386 |
- |
1387 |
- top = '.' |
1388 |
- out = 'build_directory' |
1389 |
-@@ -11,6 +12,17 @@ |
1390 |
- cairo_version_required = '1.10.0' |
1391 |
- |
1392 |
- |
1393 |
-+def check_svg(): |
1394 |
-+ if os.environ.get('PYCAIRO_DISABLE_SVG', None) is None: |
1395 |
-+ return_code = subprocess.call(['pkg-config', '--exists', 'cairo-svg']) |
1396 |
-+ if return_code == 0: |
1397 |
-+ return True |
1398 |
-+ else: |
1399 |
-+ return False |
1400 |
-+ else: |
1401 |
-+ return False |
1402 |
-+ |
1403 |
-+ |
1404 |
- def options(ctx): |
1405 |
- print(' %s/options()' %d) |
1406 |
- ctx.tool_options('gnu_dirs') |
1407 |
-@@ -39,6 +51,8 @@ |
1408 |
- ctx.define('PYCAIRO_VERSION_MAJOR', version[0]) |
1409 |
- ctx.define('PYCAIRO_VERSION_MINOR', version[1]) |
1410 |
- ctx.define('PYCAIRO_VERSION_MICRO', version[2]) |
1411 |
-+ if check_svg(): |
1412 |
-+ ctx.define('PYCAIRO_ENABLE_SVG', 1) |
1413 |
- |
1414 |
- ctx.write_config_header('src/config.h') |
1415 |
- |
1416 |
|
1417 |
diff --git a/dev-python/pycairo/files/pycairo-1.10.0-waf-py3_4.patch b/dev-python/pycairo/files/pycairo-1.10.0-waf-py3_4.patch |
1418 |
deleted file mode 100644 |
1419 |
index 6e79db9ba27..00000000000 |
1420 |
--- a/dev-python/pycairo/files/pycairo-1.10.0-waf-py3_4.patch |
1421 |
+++ /dev/null |
1422 |
@@ -1,11 +0,0 @@ |
1423 |
---- a/waflib/Tools/python.py |
1424 |
-+++ b/waflib/Tools/python.py |
1425 |
-@@ -169,7 +169,7 @@ |
1426 |
- conf.find_program('python-config-%s'%num,var='PYTHON_CONFIG',mandatory=False) |
1427 |
- includes=[] |
1428 |
- if conf.env.PYTHON_CONFIG: |
1429 |
-- for incstr in conf.cmd_and_log(conf.env.PYTHON+[conf.env.PYTHON_CONFIG,'--includes']).strip().split(): |
1430 |
-+ for incstr in conf.cmd_and_log([conf.env.PYTHON_CONFIG,'--includes']).strip().split(): |
1431 |
- if(incstr.startswith('-I')or incstr.startswith('/I')): |
1432 |
- incstr=incstr[2:] |
1433 |
- if incstr not in includes: |
1434 |
|
1435 |
diff --git a/dev-python/pycairo/files/pycairo-1.10.0-waf-unpack.patch b/dev-python/pycairo/files/pycairo-1.10.0-waf-unpack.patch |
1436 |
deleted file mode 100644 |
1437 |
index 7d54ba160d6..00000000000 |
1438 |
--- a/dev-python/pycairo/files/pycairo-1.10.0-waf-unpack.patch |
1439 |
+++ /dev/null |
1440 |
@@ -1,12 +0,0 @@ |
1441 |
---- a/waf |
1442 |
-+++ b/waf |
1443 |
-@@ -153,6 +153,9 @@ |
1444 |
- return dir |
1445 |
- |
1446 |
- wafdir = find_lib() |
1447 |
-+if sys.argv[1:] == ['unpack']: |
1448 |
-+ print(wafdir) |
1449 |
-+ exit() |
1450 |
- sys.path.insert(0, wafdir) |
1451 |
- from waflib.Tools.c_config import MACRO_TO_DESTOS |
1452 |
- MACRO_TO_DESTOS['__POWERPC__'] = 'darwin' |
1453 |
|
1454 |
diff --git a/dev-python/pycairo/files/pycairo-1.10.0-xpyb.patch b/dev-python/pycairo/files/pycairo-1.10.0-xpyb.patch |
1455 |
deleted file mode 100644 |
1456 |
index 33de2692f83..00000000000 |
1457 |
--- a/dev-python/pycairo/files/pycairo-1.10.0-xpyb.patch |
1458 |
+++ /dev/null |
1459 |
@@ -1,41 +0,0 @@ |
1460 |
---- pycairo-1.10.0/wscript |
1461 |
-+++ pycairo-1.10.0/wscript |
1462 |
-@@ -10,6 +10,7 @@ |
1463 |
- APPNAME='pycairo' |
1464 |
- VERSION='1.10.0' |
1465 |
- cairo_version_required = '1.10.0' |
1466 |
-+xpyb_version_required = '1.3' # optional |
1467 |
- |
1468 |
- |
1469 |
- def check_svg(): |
1470 |
-@@ -23,6 +24,17 @@ |
1471 |
- return False |
1472 |
- |
1473 |
- |
1474 |
-+def check_xpyb(): |
1475 |
-+ if os.environ.get('PYCAIRO_DISABLE_XPYB', None) is None: |
1476 |
-+ return_code = subprocess.call(['pkg-config', '--exists', 'xpyb']) |
1477 |
-+ if return_code == 0: |
1478 |
-+ return True |
1479 |
-+ else: |
1480 |
-+ return False |
1481 |
-+ else: |
1482 |
-+ return False |
1483 |
-+ |
1484 |
-+ |
1485 |
- def options(ctx): |
1486 |
- print(' %s/options()' %d) |
1487 |
- ctx.tool_options('gnu_dirs') |
1488 |
-@@ -42,6 +54,12 @@ |
1489 |
- ctx.check_cfg(package='cairo', atleast_version=cairo_version_required, |
1490 |
- args='--cflags --libs') |
1491 |
- |
1492 |
-+# xpyb for Python 3 is not available yet. |
1493 |
-+# the Python 3 version should probably have a different name than 'xpyb' |
1494 |
-+# if check_xpyb(): |
1495 |
-+# ctx.check_cfg(package='xpyb', atleast_version=xpyb_version_required, |
1496 |
-+# args='--cflags --libs', mandatory=False) |
1497 |
-+ |
1498 |
- # add gcc options |
1499 |
- if env['CC_NAME'] == 'gcc': |
1500 |
- env.append_unique('CCFLAGS', ['-std=c99', '-Wall']) |
1501 |
|
1502 |
diff --git a/dev-python/pycairo/pycairo-1.10.0-r5.ebuild b/dev-python/pycairo/pycairo-1.10.0-r5.ebuild |
1503 |
index 7a63fcf48d4..b61eec3973d 100644 |
1504 |
--- a/dev-python/pycairo/pycairo-1.10.0-r5.ebuild |
1505 |
+++ b/dev-python/pycairo/pycairo-1.10.0-r5.ebuild |
1506 |
@@ -15,7 +15,8 @@ DESCRIPTION="Python bindings for the cairo library" |
1507 |
HOMEPAGE="http://cairographics.org/pycairo/ https://pypi.python.org/pypi/pycairo" |
1508 |
SRC_URI=" |
1509 |
http://cairographics.org/releases/py2cairo-${PYCAIRO_PYTHON2_VERSION}.tar.bz2 |
1510 |
- http://cairographics.org/releases/pycairo-${PYCAIRO_PYTHON3_VERSION}.tar.bz2" |
1511 |
+ http://cairographics.org/releases/pycairo-${PYCAIRO_PYTHON3_VERSION}.tar.bz2 |
1512 |
+ https://dev.gentoo.org/~mgorny/dist/${P}-gentoo-patchset.tar.bz2" |
1513 |
|
1514 |
# LGPL-3 for pycairo 1.10.0. |
1515 |
# || ( LGPL-2.1 MPL-1.1 ) for pycairo 1.8.10. |
1516 |
@@ -39,19 +40,19 @@ src_prepare() { |
1517 |
pushd "${WORKDIR}/pycairo-${PYCAIRO_PYTHON3_VERSION}" > /dev/null || die |
1518 |
rm -f src/config.h || die |
1519 |
epatch \ |
1520 |
- "${FILESDIR}/${PN}-1.10.0-svg_check.patch" \ |
1521 |
- "${FILESDIR}/${PN}-1.10.0-xpyb.patch" \ |
1522 |
- "${FILESDIR}/${PN}-1.10.0-waf-unpack.patch" \ |
1523 |
- "${FILESDIR}"/py2cairo-1.10.0-ppc-darwin.patch \ |
1524 |
- "${FILESDIR}"/pycairo-1.10.0-101_pycairo-region.patch |
1525 |
+ "${WORKDIR}/${P}-gentoo-patchset/${PN}-1.10.0-svg_check.patch" \ |
1526 |
+ "${WORKDIR}/${P}-gentoo-patchset/${PN}-1.10.0-xpyb.patch" \ |
1527 |
+ "${WORKDIR}/${P}-gentoo-patchset/${PN}-1.10.0-waf-unpack.patch" \ |
1528 |
+ "${WORKDIR}/${P}-gentoo-patchset"/py2cairo-1.10.0-ppc-darwin.patch \ |
1529 |
+ "${WORKDIR}/${P}-gentoo-patchset"/pycairo-1.10.0-101_pycairo-region.patch |
1530 |
popd > /dev/null |
1531 |
|
1532 |
pushd "${WORKDIR}/py2cairo-${PYCAIRO_PYTHON2_VERSION}" > /dev/null || die |
1533 |
rm -f src/config.h || die |
1534 |
epatch \ |
1535 |
- "${FILESDIR}/py2cairo-1.10.0-svg_check.patch" \ |
1536 |
- "${FILESDIR}/py2cairo-1.10.0-xpyb.patch" \ |
1537 |
- "${FILESDIR}"/py2cairo-1.10.0-ppc-darwin.patch |
1538 |
+ "${WORKDIR}/${P}-gentoo-patchset/py2cairo-1.10.0-svg_check.patch" \ |
1539 |
+ "${WORKDIR}/${P}-gentoo-patchset/py2cairo-1.10.0-xpyb.patch" \ |
1540 |
+ "${WORKDIR}/${P}-gentoo-patchset"/py2cairo-1.10.0-ppc-darwin.patch |
1541 |
popd > /dev/null |
1542 |
|
1543 |
preparation() { |
1544 |
@@ -61,10 +62,10 @@ src_prepare() { |
1545 |
wafdir="$(./waf unpack)" |
1546 |
pushd "${wafdir}" > /dev/null || die |
1547 |
epatch \ |
1548 |
- "${FILESDIR}/${PN}-1.10.0-waf-py3_4.patch" \ |
1549 |
- "${FILESDIR}"/pycairo-1.10.0-50_specify-encoding-in-waf.patch \ |
1550 |
- "${FILESDIR}"/pycairo-1.10.0-80_fix-pickle.patch \ |
1551 |
- "${FILESDIR}"/pycairo-1.10.0-81_pickling-again.patch |
1552 |
+ "${WORKDIR}/${P}-gentoo-patchset/${PN}-1.10.0-waf-py3_4.patch" \ |
1553 |
+ "${WORKDIR}/${P}-gentoo-patchset"/pycairo-1.10.0-50_specify-encoding-in-waf.patch \ |
1554 |
+ "${WORKDIR}/${P}-gentoo-patchset"/pycairo-1.10.0-80_fix-pickle.patch \ |
1555 |
+ "${WORKDIR}/${P}-gentoo-patchset"/pycairo-1.10.0-81_pickling-again.patch |
1556 |
|
1557 |
popd > /dev/null |
1558 |
popd > /dev/null |