guix-commits
[Top][All Lists]
Advanced

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

03/07: gnu: Python: Remove bundled libraries.


From: guix-commits
Subject: 03/07: gnu: Python: Remove bundled libraries.
Date: Sat, 23 Mar 2019 18:28:02 -0400 (EDT)

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

commit d1659c0fb27c4f71c8ddc6a85d3cd9f3a10cca97
Author: Marius Bakke <address@hidden>
Date:   Sat Mar 23 15:31:09 2019 +0100

    gnu: Python: Remove bundled libraries.
    
    Fixes <https://bugs.gnu.org/32957>.
    
    * gnu/packages/python.scm (python-2.7)[source](snippet): Remove bundled
    libffi, expat and zlib.  Add substitution to make pyexpat use system expat.
    [arguments]: Add "--with-system-expat" to #:configure-flags.
    [inputs]: Add EXPAT.
    * gnu/packages/python.scm (python-3.7)[source](snippet): Delete bundled 
expat
    and add the same pyexpat substitution.
    * gnu/packages/python.scm (python2-minimal, python-minimal)[inputs]: Add 
EXPAT.
---
 gnu/packages/python.scm | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 064b8db..aa2f8ad 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -26,7 +26,7 @@
 ;;; Copyright © 2016, 2017 ng0 <address@hidden>
 ;;; Copyright © 2016 Dylan Jeffers <address@hidden@openmailbox.org>
 ;;; Copyright © 2016 David Craven <address@hidden>
-;;; Copyright © 2016, 2017, 2018 Marius Bakke <address@hidden>
+;;; Copyright © 2016, 2017, 2018, 2019 Marius Bakke <address@hidden>
 ;;; Copyright © 2016, 2017 Stefan Reichör <address@hidden>
 ;;; Copyright © 2016 Dylan Jeffers <address@hidden@openmailbox.org>
 ;;; Copyright © 2016, 2017 Alex Vong <address@hidden>
@@ -85,6 +85,7 @@
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages tcl)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages xml)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix utils)
@@ -109,11 +110,19 @@
                                "python-2.7-source-date-epoch.patch"
                                "python-2.7-adjust-tests.patch"))
       (modules '((guix build utils)))
-      ;; suboptimal to delete failing tests here, but if we delete them in the
-      ;; arguments then we need to make sure to strip out that phase when it
-      ;; gets inherited by python and python-minimal.
       (snippet
        '(begin
+          ;; Ensure the bundled copies of these libraries are not used.
+          (for-each delete-file-recursively
+                    '("Modules/_ctypes/libffi" "Modules/expat" "Modules/zlib"))
+
+          (substitute* "Modules/Setup.dist"
+            ;; Link Expat instead of embedding the bundled one.
+            (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))
+
+          ;; Suboptimal to delete failing tests here, but if we delete them in
+          ;; the arguments then we need to make sure to strip out that phase
+          ;; when it gets inherited by python and python-minimal.
           (for-each delete-file
                     '("Lib/test/test_compileall.py"
                       "Lib/test/test_ctypes.py" ; fails on mips64el
@@ -130,6 +139,7 @@
      `(#:test-target "test"
        #:configure-flags
        (list "--enable-shared"                    ;allow embedding
+             "--with-system-expat"                ;for XML support
              "--with-system-ffi"                  ;build ctypes
              "--with-ensurepip=install"           ;install pip and setuptools
              "--enable-unicode=ucs4"
@@ -258,6 +268,7 @@
                 #t))))))
     (inputs
      `(("bzip2" ,bzip2)
+       ("expat" ,expat)
        ("gdbm" ,gdbm)
        ("libffi" ,libffi)                         ; for ctypes
        ("sqlite" ,sqlite)                         ; for sqlite extension
@@ -311,8 +322,15 @@ data types.")
               (sha256
                (base32
                 "1fzi9d2gibh0wzwidyckzbywsxcsbckgsl05ryxlifxia77fhgyq"))
+              (modules '((guix build utils)))
               (snippet
                '(begin
+                  ;; Delete the bundled copy of libexpat.
+                  (delete-file-recursively "Modules/expat")
+                  (substitute* "Modules/Setup.dist"
+                    ;; Link Expat instead of embedding the bundled one.
+                    (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))
+
                   (for-each delete-file
                             '(;; This test may hang and eventually run out of
                               ;; memory on some systems:
@@ -379,8 +397,10 @@ data types.")
 
     ;; Keep zlib, which is used by 'pip' (via the 'zipimport' module), which
     ;; is invoked upon 'make install'.  'pip' also expects 'ctypes' and thus
-    ;; libffi.
-    (inputs `(("libffi" ,libffi)
+    ;; libffi.  Expat is needed for XML support which is expected by a lot
+    ;; of libraries out there.
+    (inputs `(("expat" ,expat)
+              ("libffi" ,libffi)
               ("zlib" ,zlib)))))
 
 (define-public python-minimal
@@ -390,8 +410,10 @@ data types.")
 
     ;; Build fails due to missing ctypes without libffi.
     ;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
-    ;; zlib is required by 'zipimport', used by pip.
-    (inputs `(("libffi" ,libffi)
+    ;; zlib is required by 'zipimport', used by pip.  Expat is needed
+    ;; for XML support, which is generally expected to be available.
+    (inputs `(("expat" ,expat)
+              ("libffi" ,libffi)
               ("openssl" ,openssl)
               ("zlib" ,zlib)))))
 



reply via email to

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