guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/04: gnu: python2-cython: Fix failing test.


From: guix-commits
Subject: 02/04: gnu: python2-cython: Fix failing test.
Date: Sat, 13 Jul 2019 12:54:15 -0400 (EDT)

mbakke pushed a commit to branch core-updates
in repository guix.

commit da460865074bf3cc3b3c51e7678909e7e755787a
Author: Marius Bakke <address@hidden>
Date:   Sat Jul 13 18:50:59 2019 +0200

    gnu: python2-cython: Fix failing test.
    
    This started failing because Python no longer bundles libexpat since
    commit d1659c0fb27c4f71c8ddc6a85d3cd9f3a10cca97.
    
    * gnu/packages/python-xyz.scm (python2-cython)[arguments]: New field.
---
 gnu/packages/python-xyz.scm | 38 +++++++++++++++++++++++++++++++++-----
 1 file changed, 33 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index ac1c66a..943ffdd 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -3239,11 +3239,39 @@ writing C extensions for Python as easy as Python 
itself.")
     (properties `((python2-variant . ,(delay python2-cython))))))
 
 (define-public python2-cython
-  (package (inherit (package-with-python2
-                     (strip-python2-variant python-cython)))
-    (name "python2-cython")
-    (inputs
-     `(("python-2" ,python-2))))) ; this is not automatically changed
+  (let ((base (package-with-python2 (strip-python2-variant python-cython))))
+    (package
+      (inherit base)
+      (name "python2-cython")
+      (inputs
+       `(("python-2" ,python-2)))       ;this is not automatically changed
+      (arguments
+       (substitute-keyword-arguments (package-arguments base)
+         ((#:phases phases)
+          `(modify-phases ,phases
+             (add-before 'check 'adjust-test_embed
+               (lambda _
+                 (substitute* "runtests.py"
+                   ;; test_embed goes great lengths to find the static 
libpythonX.Y.a
+                   ;; so it can give the right -L flag to GCC when embedding 
static
+                   ;; builds of Python.  It is unaware that the Python "config"
+                   ;; directory (where the static library lives) was renamed in
+                   ;; Python 3, and falls back to 
sysconfig.get_config_var('LIBDIR'),
+                   ;; which works fine, because that is where the shared 
library is.
+                   ;;
+                   ;; It also appears to be unaware that the Makefile in 
Demos/embed
+                   ;; already unconditionally pass the static library location 
to GCC,
+                   ;; after checking sysconfig.get_config_var('LIBPL).
+                   ;;
+                   ;; The effect is that the linker is unable to resolve 
libexpat
+                   ;; symbols when building for Python 2, because neither the 
Python 2
+                   ;; shared library nor Expat is available.   To fix it, we 
can either
+                   ;; add Expat as an input and make it visible to the linker, 
or just
+                   ;; prevent it from overriding the Python shared library 
location.
+                   ;; The end result is identical, so we take the easy route.
+                   ((" or libname not in os\\.listdir\\(libdir\\)")
+                    ""))
+                 #t)))))))))
 
 ;; The RPython toolchain currently does not support Python 3.
 (define-public python2-rpython



reply via email to

[Prev in Thread] Current Thread [Next in Thread]