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.
This commit is contained in:
Danny Milosavljevic 2018-07-16 23:48:24 +02:00
parent 8e632a6435
commit a545090ce5
No known key found for this signature in database
GPG key ID: E71A35542C30BAA5
3 changed files with 45 additions and 4 deletions

View file

@ -1057,6 +1057,7 @@ dist_patch_DATA = \
%D%/packages/patches/python-3-search-paths.patch \ %D%/packages/patches/python-3-search-paths.patch \
%D%/packages/patches/python-3-fix-tests.patch \ %D%/packages/patches/python-3-fix-tests.patch \
%D%/packages/patches/python-axolotl-AES-fix.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-dendropy-fix-tests.patch \
%D%/packages/patches/python-fix-tests.patch \ %D%/packages/patches/python-fix-tests.patch \
%D%/packages/patches/python-genshi-add-support-for-python-3.4-AST.patch \ %D%/packages/patches/python-genshi-add-support-for-python-3.4-AST.patch \

View file

@ -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))

View file

@ -4210,23 +4210,53 @@ (define-public python-cairocffi
(file-name (string-append name "-" version ".tar.gz")) (file-name (string-append name "-" version ".tar.gz"))
(sha256 (sha256
(base32 (base32
"1rk2dvy3fxrga6bvvxc2fi5lbaynm5h4a0w0aaxyn3bc77rszjg9")))) "1rk2dvy3fxrga6bvvxc2fi5lbaynm5h4a0w0aaxyn3bc77rszjg9"))
(patches (search-patches "python-cairocffi-dlopen-path.patch"))))
(build-system python-build-system) (build-system python-build-system)
(outputs '("out" "doc")) (outputs '("out" "doc"))
(inputs (inputs
`(("gdk-pixbuf" ,gdk-pixbuf) `(("glib" ,glib)
("cairo" ,cairo))) ("gtk+" ,gtk+)
("gdk-pixbuf" ,gdk-pixbuf)
("cairo" ,cairo)
("pango" ,pango)))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config) `(("pkg-config" ,pkg-config)
("python-pytest" ,python-pytest)
("python-sphinx" ,python-sphinx) ("python-sphinx" ,python-sphinx)
("python-docutils" ,python-docutils))) ("python-docutils" ,python-docutils)))
(propagated-inputs (propagated-inputs
`(("python-xcffib" ,python-xcffib))) ; used at run time `(("python-xcffib" ,python-xcffib))) ; used at run time
(arguments (arguments
`(;; FIXME: Tests cannot find 'libcairo.so.2'. `(;; FIXME: Tests cannot find 'libcairo.so.2'.
#:tests? #f #:tests? #t
#:phases #:phases
(modify-phases %standard-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 (add-after 'install 'install-doc
(lambda* (#:key inputs outputs #:allow-other-keys) (lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((data (string-append (assoc-ref outputs "doc") "/share")) (let* ((data (string-append (assoc-ref outputs "doc") "/share"))