summary refs log tree commit diff
path: root/gnu/packages/python.scm
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 /gnu/packages/python.scm
parent8e632a6435bb8ea408127833030f7764b78768a9 (diff)
downloadguix-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.
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm38
1 files changed, 34 insertions, 4 deletions
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"))