dev-python/pycairo: Fix bug #367293 for portage-multilib users by hackily patching...
authorNathan Phillip Brink <binki@gentoo.org>
Mon, 20 Feb 2012 03:51:16 +0000 (03:51 +0000)
committerNathan Phillip Brink <binki@gentoo.org>
Mon, 20 Feb 2012 03:51:16 +0000 (03:51 +0000)
(Portage version: 2.2.0_alpha84-r1/git/Linux x86_64, RepoMan options: --force, signed Manifest commit with key 6BA81050)

dev-python/pycairo/Manifest [new file with mode: 0644]
dev-python/pycairo/files/py2cairo-1.10.0-svg_check.patch [new file with mode: 0644]
dev-python/pycairo/files/pycairo-1.10.0-svg_check.patch [new file with mode: 0644]
dev-python/pycairo/metadata.xml [new file with mode: 0644]
dev-python/pycairo/pycairo-1.10.0-r2.ebuild [new file with mode: 0644]

diff --git a/dev-python/pycairo/Manifest b/dev-python/pycairo/Manifest
new file mode 100644 (file)
index 0000000..7c26183
--- /dev/null
@@ -0,0 +1,27 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA512
+
+AUX py2cairo-1.10.0-svg_check.patch 2912 RMD160 79cbae6b38baeb1a55309aa41cb40bd0bb2ad1b2 SHA1 fdd5a4f9b9f17aa0f48e62ef97359f57046da46e SHA256 c35d96be5be571c2f4c3415e4016a7e70a5edd6164818af80d16855e4e4efe72
+AUX pycairo-1.10.0-svg_check.patch 2924 RMD160 e0a01e9587ad47dc00a0d449fb3d00fcfbacfe7a SHA1 3969a610e8431938605c7eae5a86b43ef0c9881c SHA256 f9d2bac70bcca57c523e69403cb7332bf4ade0427998b6a3dc16730bcc17b6c7
+DIST py2cairo-1.10.0.tar.bz2 402070 RMD160 ce75db9af32ef1a3e90f6aaa649cbb2493a941a4 SHA1 2efa8dfafbd6b8e492adaab07231556fec52d6eb SHA256 d30439f06c2ec1a39e27464c6c828b6eface3b22ee17b2de05dc409e429a7431
+DIST pycairo-1.10.0-waf-multilib.patch 761 RMD160 1e2210e0a7c7ec2fc19245d512c0d762ca9aed1f SHA1 bbaef5a3699a53023efb659a86a97180e34dee56 SHA256 8e9e081bf7b4beced282a8de265b6e8901b113df7fbe892d7f0f93c63c771e5b
+DIST pycairo-1.10.0.tar.bz2 246556 RMD160 7d1c1c05113e5bbad32dbe96c65c918b170cac33 SHA1 b4283aa1cc9aafd12fd72ad371303a486da1d014 SHA256 9aa4078e7eb5be583aeabbe8d87172797717f95e8c4338f0d4a17b683a7253be
+EBUILD pycairo-1.10.0-r2.ebuild 4956 RMD160 8b647aaf910d5614800c9f8971b76be108a7437d SHA1 a97b1ce6799116e06a0da9936dc1abb04bd66af8 SHA256 2ed5dfce4549fdb69c3dd6c2a64dd5d5b48f538bfef69c8858bb0820ac2f80db
+MISC metadata.xml 244 RMD160 763839a53ccf1e2a58d249cfa2d94feeaa69e29c SHA1 fe85b5f10031620b8d1da84d695ec3080df29d82 SHA256 f5bde347c36c74889cbb32d29f06766c08eb3df6e0c468f00295681382c48457
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.14 (GNU/Linux)
+
+iQIcBAEBCgAGBQJPQcM0AAoJEHQ6UuhrqBBQ//8P/Rorh+75shJuPQXl9G06/v/F
+yAmTi3VIDxh6+hzGnYs40+78Q5maCXfUnA7i66PdsYvwidceNxl3mddo2dTLtlPm
+uEKrXlaMHC1A3wTjKj0Zh+LtlWMU8/x83HV5jKOQy0E/45XnccvhIKnaADUXzatb
+z486ITlx4V0V1Kg/sCdqWkVT0EfJ5GdreXqcdOwqbEWVoVcvv15des5hSAwKM5ON
+1IJ5IJwln2ivI68cYA6nLrhHz6tieqqA4cie/G61z9Wapz8ZMXCEGiE3139sTQQi
+8+A2Yf/nkvT3AKLqVoxbsnbVf5qgHiE2m+zzTWw8/58ZbdpghS9wFHroSLIxDxX9
+M9Pld7XFj1zWjbINvItgE5Y7H1B9HHofx01xB8Xbq0hrTOQpK5pTknDTXTwVMJgu
+ktro/yL4B4Erhuc0l/m2NiSG/x+oHDUzWG06+wXjAlXXP8T4oGJMIDy6qvNhHP6z
+FgXDs8HEjJFmPo10WtZ/Izbcqs7//t4wWFCm41efGfHUK6T1HX5skaesKL7qxOSK
+PiP36IXImfBMvDN4hqI4mWGcEQHgz+z/abGu0igbooCZOkycTShVxoqFszlLjRkv
+wU4TVGGAEc5GrMpgnWNj8cMZiEpKasvkF3BU36fEJEXbZSZQTbYqmWxCh6IxossX
+RsAQNTKPLXnZhWEw5jXa
+=tF88
+-----END PGP SIGNATURE-----
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
new file mode 100644 (file)
index 0000000..4cd755c
--- /dev/null
@@ -0,0 +1,126 @@
+--- 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')
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
new file mode 100644 (file)
index 0000000..572a5f6
--- /dev/null
@@ -0,0 +1,126 @@
+--- src/cairomodule.c
++++ src/cairomodule.c
+@@ -116,7 +116,7 @@
+ #else
+   0,
+ #endif
+-#ifdef CAIRO_HAS_SVG_SURFACE
++#ifdef PYCAIRO_ENABLE_SVG
+   &PycairoSVGSurface_Type,
+ #else
+   0,
+@@ -247,7 +247,7 @@
+   if (PyType_Ready(&PycairoPSSurface_Type) < 0)
+     return NULL;
+ #endif
+-#ifdef CAIRO_HAS_SVG_SURFACE
++#ifdef PYCAIRO_ENABLE_SVG
+   if (PyType_Ready(&PycairoSVGSurface_Type) < 0)
+     return NULL;
+ #endif
+@@ -337,7 +337,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
+@@ -399,7 +399,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
+@@ -75,7 +75,7 @@
+ extern PyTypeObject PycairoPSSurface_Type;
+ #endif
+-#if CAIRO_HAS_SVG_SURFACE
++#if PYCAIRO_ENABLE_SVG
+ extern PyTypeObject PycairoSVGSurface_Type;
+ #endif
+--- src/py3cairo.h
++++ src/py3cairo.h
+@@ -171,7 +171,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
+@@ -72,7 +72,7 @@
+     type = &PycairoPSSurface_Type;
+     break;
+ #endif
+-#if CAIRO_HAS_SVG_SURFACE
++#if PYCAIRO_ENABLE_SVG
+   case CAIRO_SURFACE_TYPE_SVG:
+     type = &PycairoSVGSurface_Type;
+     break;
+@@ -1022,7 +1022,7 @@
+ /* Class SVGSurface(Surface) ----------------------------------------------- */
+-#ifdef CAIRO_HAS_SVG_SURFACE
++#ifdef PYCAIRO_ENABLE_SVG
+ #include <cairo-svg.h>
+ static PyObject *
+@@ -1133,7 +1133,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')
diff --git a/dev-python/pycairo/metadata.xml b/dev-python/pycairo/metadata.xml
new file mode 100644 (file)
index 0000000..5484483
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <maintainer>
+    <email>binki@gentoo.org</email>
+    <name>Nathan Phillip Brink</name>
+  </maintainer>
+</pkgmetadata>
diff --git a/dev-python/pycairo/pycairo-1.10.0-r2.ebuild b/dev-python/pycairo/pycairo-1.10.0-r2.ebuild
new file mode 100644 (file)
index 0000000..d6c42a7
--- /dev/null
@@ -0,0 +1,167 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pycairo/pycairo-1.10.0-r2.ebuild,v 1.7 2012/02/13 19:35:24 xarthisius Exp $
+
+EAPI="3"
+PYTHON_DEPEND="2:2.6 3:3.1"
+SUPPORT_PYTHON_ABIS="1"
+RESTRICT_PYTHON_ABIS="2.4 2.5 3.0 *-jython"
+
+inherit eutils python waf-utils
+
+PYCAIRO_PYTHON2_VERSION="${PV}"
+PYCAIRO_PYTHON3_VERSION="${PV}"
+
+DESCRIPTION="Python bindings for the cairo library"
+HOMEPAGE="http://cairographics.org/pycairo/ http://pypi.python.org/pypi/pycairo"
+SRC_URI="http://cairographics.org/releases/py2cairo-${PYCAIRO_PYTHON2_VERSION}.tar.bz2
+       http://cairographics.org/releases/pycairo-${PYCAIRO_PYTHON3_VERSION}.tar.bz2
+       http://dev.gentoo.org/~binki/distfiles/dev-python/${PN}/${P}-waf-multilib.patch"
+
+# LGPL-3 for pycairo 1.10.0.
+# || ( LGPL-2.1 MPL-1.1 ) for pycairo 1.8.10.
+LICENSE="LGPL-3 || ( LGPL-2.1 MPL-1.1 )"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 ~mips ppc ppc64 sh sparc x86 ~x86-fbsd ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris ~x86-solaris"
+IUSE="doc examples +svg test"
+
+RDEPEND=">=x11-libs/cairo-1.10.0[svg?]"
+DEPEND="${RDEPEND}
+       dev-util/pkgconfig
+       test? ( dev-python/pytest )"
+
+PYTHON_CFLAGS=("2.* + -fno-strict-aliasing")
+
+# In case if waf-utils.eclass actually accepts waf-utils_waflibdir() as
+# a function.
+unset waf-utils_waflibdir 2>/dev/null
+
+# @FUNCTION: waf-utils_waflibdir
+# @USAGE: [<waf-binary>]
+# @DESCRIPTION:
+# Echoes the absolute path to the directory containing waf-based
+# project's waflib python module. Ensures that the waflib shipped with a
+# project is unpacked if it isn't already. This waflib may be safely
+# patched because waf-lite will not touch the waflib directory when it
+# is run if it already exists. Uses the waf binary in WAF_BINARY or the
+# first argument.
+#
+# @EXAMPLE
+# @CODE
+# pushd "$(waf-utils_waflibdir)" || die "Unable to patch waflib"
+# epatch "${FILESDIR}"/${P}-waf-fix.patch
+# popd
+# @CODE
+#
+# Note that if you are using the python eclass, you must either call
+# python_set_active_version or call waf-utils_waflibdir() from within a
+# function run by python_execute().
+#
+# @CODE
+# SUPPORT_PYTHON_ABIS=1
+# inherit python
+#
+# src_prepare() {
+#      python_copy_sources
+#
+#      myprepare() {
+#              epatch "${FILESDIR}"/${P}-sourcecode-fix.patch
+#
+#              pushd "$(waf-utils_saflibdir "$(PYTHON)" waf)" || die "Unable to patch waflib"
+#              epatch "${FILESDIR}"/${P}-waf-fix.patch
+#              popd
+#      }
+#      python_execute_function -s myprepare
+# }
+# @CODE
+waf-utils_waflibdir() {
+       debug-print-function ${FUNCNAME} "$@"
+
+       # @ECLASS-VARIABLE: WAF_BINARY
+       # @DESCRIPTION:
+       # Eclass can use different waf executable. Usually it is located in "${S}/waf".
+       : ${WAF_BINARY:="${S}/waf"}
+
+       local waf_binary=${WAF_BINARY}
+       [[ -n ${1} ]] && waf_binary=${1}
+
+       python -c "import imp, sys; sys.argv[0] = '${waf_binary}'; waflite = imp.load_source('waflite', '${waf_binary}'); print(waflite.find_lib());" \
+               || die "Unable to locate or unpack waflib module from the waf script at ${waf_binary}"
+}
+
+# When moving between the different build dirs, we want to use the waf
+# associated with each build dir.
+WAF_BINARY=./waf
+
+src_prepare() {
+
+       pushd "${WORKDIR}/pycairo-${PYCAIRO_PYTHON3_VERSION}" > /dev/null
+       rm -f src/config.h || die
+       epatch "${FILESDIR}/${PN}-1.10.0-svg_check.patch"
+       popd > /dev/null
+
+       pushd "${WORKDIR}/py2cairo-${PYCAIRO_PYTHON2_VERSION}" > /dev/null
+       rm -f src/config.h || die
+       epatch "${FILESDIR}/py2cairo-1.10.0-svg_check.patch"
+       popd > /dev/null
+
+       preparation() {
+               local srcdir=${WORKDIR}/${P}-${PYTHON_ABI}
+               if [[ "${PYTHON_ABI}" == 3.* ]]; then
+                       cp -r "${WORKDIR}/pycairo-${PYCAIRO_PYTHON3_VERSION}" "${srcdir}"
+               else
+                       cp -r "${WORKDIR}/py2cairo-${PYCAIRO_PYTHON2_VERSION}" "${srcdir}"
+               fi
+
+               cd "$(waf-utils_waflibdir ${srcdir}/waf)" || die "Unable to patch waflib"
+               epatch "${DISTDIR}"/${P}-waf-multilib.patch
+       }
+       python_execute_function preparation
+}
+
+src_configure() {
+       if ! use svg; then
+               export PYCAIRO_DISABLE_SVG="1"
+       fi
+
+       python_execute_function -s waf-utils_src_configure --nopyc --nopyo
+}
+
+src_compile() {
+       python_execute_function -s waf-utils_src_compile
+}
+
+src_test() {
+       test_installation() {
+               ./waf install --destdir="${T}/tests/${PYTHON_ABI}"
+       }
+       python_execute_function -q -s test_installation
+
+       python_execute_py.test -P '${T}/tests/${PYTHON_ABI}${EPREFIX}$(python_get_sitedir)' -s
+}
+
+src_install() {
+       python_execute_function -s waf-utils_src_install
+
+       dodoc AUTHORS NEWS README || die "dodoc failed"
+
+       if use doc; then
+               pushd doc/_build/html > /dev/null
+               insinto /usr/share/doc/${PF}/html
+               doins -r [a-z]* _static || die "Installation of documentation failed"
+               popd > /dev/null
+       fi
+
+       if use examples; then
+               insinto /usr/share/doc/${PF}/examples
+               doins -r examples/* || die "Installation of examples failed"
+       fi
+}
+
+pkg_postinst() {
+       python_mod_optimize cairo
+}
+
+pkg_postrm() {
+       python_mod_cleanup cairo
+}