From a545090ce5e6b9da1f473f558dabda69f317e461 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Mon, 16 Jul 2018 23:48:24 +0200 Subject: gnu: python-cairocffi: Fix loading of shared libraries. Fixes . * 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. --- gnu/local.mk | 1 + .../patches/python-cairocffi-dlopen-path.patch | 10 ++++++ gnu/packages/python.scm | 38 +++++++++++++++++++--- 3 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 gnu/packages/patches/python-cairocffi-dlopen-path.patch 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 @@ (define-public python-cairocffi (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")) -- cgit v1.2.3