forked from mirrors/nixpkgs
cairocffi: Add missing dependencies on gdk_pixbuf
Rewrite dlopening stuff in hacky way (due ctypes.util totally brokennes: it attempt to use /sbin/ldconfig, gcc from PATH and other tricks to detect sonames, I replaced it with simple table lookup) Also I add patch to bypass another rounding regression in tests (this patch submitted upstream as well)
This commit is contained in:
parent
b99e339419
commit
b13e44e094
47
pkgs/development/python-modules/cairocffi/dlopen-paths.patch
Normal file
47
pkgs/development/python-modules/cairocffi/dlopen-paths.patch
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
commit 705dc9a55bd160625d9996e63fc7dc532d0ad0ab
|
||||||
|
Author: Alexander V. Nikolaev <avn@avnik.info>
|
||||||
|
Date: Sat Feb 6 08:09:06 2016 +0200
|
||||||
|
|
||||||
|
Patch dlopen() to allow direct paths to all required libs
|
||||||
|
|
||||||
|
This patch is NixOS specific
|
||||||
|
|
||||||
|
diff --git a/cairocffi/__init__.py b/cairocffi/__init__.py
|
||||||
|
index 718aa7f..1a1dcff 100644
|
||||||
|
--- a/cairocffi/__init__.py
|
||||||
|
+++ b/cairocffi/__init__.py
|
||||||
|
@@ -27,20 +27,22 @@ VERSION = '0.7.2'
|
||||||
|
version = '1.10.0'
|
||||||
|
version_info = (1, 10, 0)
|
||||||
|
|
||||||
|
+# Use hardcoded soname, because ctypes.util use gcc/objdump which shouldn't be required for runtime
|
||||||
|
+_LIBS = {
|
||||||
|
+ 'cairo': '@cairo@/lib/libcairo.so.2',
|
||||||
|
+ 'glib-2.0': '@glib@/lib/libglib-2.0.so.0',
|
||||||
|
+ 'gobject-2.0': '@glib@/lib/libgobject-2.0.so.0',
|
||||||
|
+ 'gdk_pixbuf-2.0': '@gdk_pixbuf@/lib/libgdk_pixbuf-2.0.so.0',
|
||||||
|
+}
|
||||||
|
|
||||||
|
-def dlopen(ffi, *names):
|
||||||
|
+def dlopen(ffi, name, *names):
|
||||||
|
"""Try various names for the same library, for different platforms."""
|
||||||
|
- for name in names:
|
||||||
|
- for lib_name in [name, 'lib' + name]:
|
||||||
|
- try:
|
||||||
|
- path = ctypes.util.find_library(lib_name)
|
||||||
|
- if path:
|
||||||
|
- lib = ffi.dlopen(path)
|
||||||
|
- if lib:
|
||||||
|
- return lib
|
||||||
|
- except OSError:
|
||||||
|
- pass
|
||||||
|
- raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
|
||||||
|
+ path = _LIBS.get(name, None)
|
||||||
|
+ if path:
|
||||||
|
+ lib = ffi.dlopen(path)
|
||||||
|
+ if lib:
|
||||||
|
+ return lib
|
||||||
|
+ raise OSError("dlopen() failed to load a library: %s as %s" % (name, path))
|
||||||
|
|
||||||
|
|
||||||
|
cairo = dlopen(ffi, 'cairo', 'cairo-2')
|
|
@ -2623,17 +2623,29 @@ in modules // {
|
||||||
py.test $out/${python.sitePackages}
|
py.test $out/${python.sitePackages}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Marked broken since according to test
|
# FIXME: make gdk_pixbuf dependency optional (as wel as xcfffi)
|
||||||
# Happens with 0.7.1 and 0.7.2
|
# Happens with 0.7.1 and 0.7.2
|
||||||
# OSError: dlopen() failed to load a library: gdk_pixbuf-2.0 / gdk_pixbuf-2.0-0
|
# OSError: dlopen() failed to load a library: gdk_pixbuf-2.0 / gdk_pixbuf-2.0-0
|
||||||
|
|
||||||
patchPhase = ''
|
patches = [
|
||||||
|
# This patch from PR substituted upstream
|
||||||
|
(pkgs.fetchpatch {
|
||||||
|
url = "https://github.com/avnik/cairocffi/commit/2266882e263c5efc87350cf016d117b2ec6a1d59.patch";
|
||||||
|
sha256 = "0gb570z3ivf1b0ixsk526n3h29m8c5rhjsiyam7rr3x80dp65cdl";
|
||||||
|
})
|
||||||
|
|
||||||
|
../development/python-modules/cairocffi/dlopen-paths.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
# Hardcode cairo library path
|
# Hardcode cairo library path
|
||||||
sed -e 's,ffi\.dlopen(,&"${pkgs.cairo}/lib/" + ,' -i cairocffi/__init__.py
|
# FIXME: for closure-size branch all pkgs.foo should be replaced with pkgs.foo.lib
|
||||||
|
substituteInPlace cairocffi/__init__.py --subst-var-by cairo ${pkgs.cairo}
|
||||||
|
substituteInPlace cairocffi/__init__.py --subst-var-by glib ${pkgs.glib}
|
||||||
|
substituteInPlace cairocffi/__init__.py --subst-var-by gdk_pixbuf ${pkgs.gdk_pixbuf}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
broken = true;
|
|
||||||
homepage = https://github.com/SimonSapin/cairocffi;
|
homepage = https://github.com/SimonSapin/cairocffi;
|
||||||
license = "bsd";
|
license = "bsd";
|
||||||
description = "cffi-based cairo bindings for Python";
|
description = "cffi-based cairo bindings for Python";
|
||||||
|
|
Loading…
Reference in a new issue