linamh/dev-python/pycairo/files/py2cairo-1.10.0-svg_check.patch
geos_one 9f2a2c1429 bump
git-svn-id: https://svn.disconnected-by-peer.at/svn/linamh/trunk/linamh@2911 6952d904-891a-0410-993b-d76249ca496b
2011-06-08 15:26:24 +00:00

127 lines
2.8 KiB
Diff

--- src/cairomodule.c
+++ src/cairomodule.c
@@ -127,7 +127,7 @@
#else
0,
#endif
-#ifdef CAIRO_HAS_SVG_SURFACE
+#ifdef PYCAIRO_ENABLE_SVG
&PycairoSVGSurface_Type,
#else
0,
@@ -223,7 +223,7 @@
if (PyType_Ready(&PycairoPSSurface_Type) < 0)
return;
#endif
-#ifdef CAIRO_HAS_SVG_SURFACE
+#ifdef PYCAIRO_ENABLE_SVG
if (PyType_Ready(&PycairoSVGSurface_Type) < 0)
return;
#endif
@@ -305,7 +305,7 @@
PyModule_AddObject(m, "PSSurface", (PyObject *)&PycairoPSSurface_Type);
#endif
-#ifdef CAIRO_HAS_SVG_SURFACE
+#ifdef PYCAIRO_ENABLE_SVG
Py_INCREF(&PycairoSVGSurface_Type);
PyModule_AddObject(m, "SVGSurface", (PyObject *)&PycairoSVGSurface_Type);
#endif
@@ -379,7 +379,7 @@
#else
PyModule_AddIntConstant(m, "HAS_PS_SURFACE", 0);
#endif
-#if CAIRO_HAS_SVG_SURFACE
+#if PYCAIRO_ENABLE_SVG
PyModule_AddIntConstant(m, "HAS_SVG_SURFACE", 1);
#else
PyModule_AddIntConstant(m, "HAS_SVG_SURFACE", 0);
--- src/private.h
+++ src/private.h
@@ -86,7 +86,7 @@
extern PyTypeObject PycairoPSSurface_Type;
#endif
-#if CAIRO_HAS_SVG_SURFACE
+#if PYCAIRO_ENABLE_SVG
extern PyTypeObject PycairoSVGSurface_Type;
#endif
--- src/pycairo.h
+++ src/pycairo.h
@@ -182,7 +182,7 @@
#define PycairoPSSurface_Type *(Pycairo_CAPI->PSSurface_Type)
#endif
-#if CAIRO_HAS_SVG_SURFACE
+#if PYCAIRO_ENABLE_SVG
#define PycairoSVGSurface_Type *(Pycairo_CAPI->SVGSurface_Type)
#endif
--- src/surface.c
+++ src/surface.c
@@ -83,7 +83,7 @@
type = &PycairoPSSurface_Type;
break;
#endif
-#if CAIRO_HAS_SVG_SURFACE
+#if PYCAIRO_ENABLE_SVG
case CAIRO_SURFACE_TYPE_SVG:
type = &PycairoSVGSurface_Type;
break;
@@ -1015,7 +1015,7 @@
/* Class SVGSurface(Surface) ----------------------------------------------- */
-#ifdef CAIRO_HAS_SVG_SURFACE
+#ifdef PYCAIRO_ENABLE_SVG
#include <cairo-svg.h>
static PyObject *
@@ -1125,7 +1125,7 @@
0, /* tp_is_gc */
0, /* tp_bases */
};
-#endif /* CAIRO_HAS_SVG_SURFACE */
+#endif /* PYCAIRO_ENABLE_SVG */
#if CAIRO_HAS_WIN32_SURFACE
--- wscript
+++ wscript
@@ -1,6 +1,7 @@
# -*- python -*-
import os
+import subprocess
top = '.'
out = 'build_directory'
@@ -11,6 +12,17 @@
cairo_version_required = '1.10.0'
+def check_svg():
+ if os.environ.get('PYCAIRO_DISABLE_SVG', None) is None:
+ return_code = subprocess.call(['pkg-config', '--exists', 'cairo-svg'])
+ if return_code == 0:
+ return True
+ else:
+ return False
+ else:
+ return False
+
+
def options(ctx):
print(' %s/options()' %d)
ctx.tool_options('gnu_dirs')
@@ -39,6 +51,8 @@
ctx.define('PYCAIRO_VERSION_MAJOR', version[0])
ctx.define('PYCAIRO_VERSION_MINOR', version[1])
ctx.define('PYCAIRO_VERSION_MICRO', version[2])
+ if check_svg():
+ ctx.define('PYCAIRO_ENABLE_SVG', 1)
ctx.write_config_header('src/config.h')