aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2018-07-16 23:48:24 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2018-07-16 23:51:38 +0200
commita545090ce5e6b9da1f473f558dabda69f317e461 (patch)
tree9a6c3afa04304d5536613179dab894196fc72734
parent8e632a6435bb8ea408127833030f7764b78768a9 (diff)
downloadpatches-a545090ce5e6b9da1f473f558dabda69f317e461.tar
patches-a545090ce5e6b9da1f473f558dabda69f317e461.tar.gz
gnu: python-cairocffi: Fix loading of shared libraries.
Fixes <https://bugs.gnu.org/32170>. * gnu/packages/patches/python-cairocffi-dlopen-path.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/python.scm (python-cairocffi)[inputs]: Add glib, gtk+, pango. [native-inputs]: Add python-pytest. [arguments]: Enable tests. [arguments]<#:phases>[patch-paths]: New phase.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/patches/python-cairocffi-dlopen-path.patch10
-rw-r--r--gnu/packages/python.scm38
3 files changed, 45 insertions, 4 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index 64e71a84f8..d40b1963db 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1057,6 +1057,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-3-search-paths.patch \
%D%/packages/patches/python-3-fix-tests.patch \
%D%/packages/patches/python-axolotl-AES-fix.patch \
+ %D%/packages/patches/python-cairocffi-dlopen-path.patch \
%D%/packages/patches/python-dendropy-fix-tests.patch \
%D%/packages/patches/python-fix-tests.patch \
%D%/packages/patches/python-genshi-add-support-for-python-3.4-AST.patch \
diff --git a/gnu/packages/patches/python-cairocffi-dlopen-path.patch b/gnu/packages/patches/python-cairocffi-dlopen-path.patch
new file mode 100644
index 0000000000..e7a7fe3737
--- /dev/null
+++ b/gnu/packages/patches/python-cairocffi-dlopen-path.patch
@@ -0,0 +1,10 @@
+--- cairocffi-0.8.0/cairocffi/__init__.py.orig 2018-07-16 11:00:59.075664158 +0200
++++ cairocffi-0.8.0/cairocffi/__init__.py 2018-07-16 17:09:42.471958015 +0200
+@@ -35,6 +35,7 @@
+ return lib
+ except OSError:
+ pass
++ return ffi.dlopen(name)
+ raise OSError("dlopen() failed to load a library: %s" % ' / '.join(names))
+
+
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index ebf02af22e..fc1ef3eb2a 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -4210,23 +4210,53 @@ support for Python 3 and PyPy. It is based on cffi.")
(file-name (string-append name "-" version ".tar.gz"))
(sha256
(base32
- "1rk2dvy3fxrga6bvvxc2fi5lbaynm5h4a0w0aaxyn3bc77rszjg9"))))
+ "1rk2dvy3fxrga6bvvxc2fi5lbaynm5h4a0w0aaxyn3bc77rszjg9"))
+ (patches (search-patches "python-cairocffi-dlopen-path.patch"))))
(build-system python-build-system)
(outputs '("out" "doc"))
(inputs
- `(("gdk-pixbuf" ,gdk-pixbuf)
- ("cairo" ,cairo)))
+ `(("glib" ,glib)
+ ("gtk+" ,gtk+)
+ ("gdk-pixbuf" ,gdk-pixbuf)
+ ("cairo" ,cairo)
+ ("pango" ,pango)))
(native-inputs
`(("pkg-config" ,pkg-config)
+ ("python-pytest" ,python-pytest)
("python-sphinx" ,python-sphinx)
("python-docutils" ,python-docutils)))
(propagated-inputs
`(("python-xcffib" ,python-xcffib))) ; used at run time
(arguments
`(;; FIXME: Tests cannot find 'libcairo.so.2'.
- #:tests? #f
+ #:tests? #t
#:phases
(modify-phases %standard-phases
+ (add-after 'unpack 'patch-paths
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (substitute* (find-files "." "\\.py$")
+ (("dlopen\\(ffi, 'cairo'")
+ (string-append "dlopen(ffi, '" (assoc-ref inputs "cairo")
+ "/lib/libcairo.so.2'"))
+ (("dlopen\\(ffi, 'gdk-3'")
+ (string-append "dlopen(ffi, '" (assoc-ref inputs "gtk+")
+ "/lib/libgtk-3.so.0'"))
+ (("dlopen\\(ffi, 'gdk_pixbuf-2.0'")
+ (string-append "dlopen(ffi, '" (assoc-ref inputs "gdk-pixbuf")
+ "/lib/libgdk_pixbuf-2.0.so.0'"))
+ (("dlopen\\(ffi, 'glib-2.0'")
+ (string-append "dlopen(ffi, '" (assoc-ref inputs "glib")
+ "/lib/libglib-2.0.so.0'"))
+ (("dlopen\\(ffi, 'gobject-2.0'")
+ (string-append "dlopen(ffi, '" (assoc-ref inputs "glib")
+ "/lib/libgobject-2.0.so.0'"))
+ (("dlopen\\(ffi, 'pangocairo-1.0'")
+ (string-append "dlopen(ffi, '" (assoc-ref inputs "pango")
+ "/lib/libpangocairo-1.0.so.0'"))
+ (("dlopen\\(ffi, 'pango-1.0'")
+ (string-append "dlopen(ffi, '" (assoc-ref inputs "pango")
+ "/lib/libpango-1.0.so.0'")))
+ #t))
(add-after 'install 'install-doc
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((data (string-append (assoc-ref outputs "doc") "/share"))