mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 22:08:16 -05:00
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.
This commit is contained in:
parent
d3b22d488b
commit
d1659c0fb2
1 changed files with 30 additions and 8 deletions
|
@ -26,7 +26,7 @@
|
||||||
;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
|
;;; Copyright © 2016, 2017 ng0 <ng0@n0.is>
|
||||||
;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
|
;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
|
||||||
;;; Copyright © 2016 David Craven <david@craven.ch>
|
;;; Copyright © 2016 David Craven <david@craven.ch>
|
||||||
;;; Copyright © 2016, 2017, 2018 Marius Bakke <mbakke@fastmail.com>
|
;;; Copyright © 2016, 2017, 2018, 2019 Marius Bakke <mbakke@fastmail.com>
|
||||||
;;; Copyright © 2016, 2017 Stefan Reichör <stefan@xsteve.at>
|
;;; Copyright © 2016, 2017 Stefan Reichör <stefan@xsteve.at>
|
||||||
;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
|
;;; Copyright © 2016 Dylan Jeffers <sapientech@sapientech@openmailbox.org>
|
||||||
;;; Copyright © 2016, 2017 Alex Vong <alexvong1995@gmail.com>
|
;;; Copyright © 2016, 2017 Alex Vong <alexvong1995@gmail.com>
|
||||||
|
@ -85,6 +85,7 @@ (define-module (gnu packages python)
|
||||||
#:use-module (gnu packages sqlite)
|
#:use-module (gnu packages sqlite)
|
||||||
#:use-module (gnu packages tcl)
|
#:use-module (gnu packages tcl)
|
||||||
#:use-module (gnu packages tls)
|
#:use-module (gnu packages tls)
|
||||||
|
#:use-module (gnu packages xml)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix download)
|
#:use-module (guix download)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
|
@ -109,11 +110,19 @@ (define-public python-2.7
|
||||||
"python-2.7-source-date-epoch.patch"
|
"python-2.7-source-date-epoch.patch"
|
||||||
"python-2.7-adjust-tests.patch"))
|
"python-2.7-adjust-tests.patch"))
|
||||||
(modules '((guix build utils)))
|
(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
|
(snippet
|
||||||
'(begin
|
'(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
|
(for-each delete-file
|
||||||
'("Lib/test/test_compileall.py"
|
'("Lib/test/test_compileall.py"
|
||||||
"Lib/test/test_ctypes.py" ; fails on mips64el
|
"Lib/test/test_ctypes.py" ; fails on mips64el
|
||||||
|
@ -130,6 +139,7 @@ (define-public python-2.7
|
||||||
`(#:test-target "test"
|
`(#:test-target "test"
|
||||||
#:configure-flags
|
#:configure-flags
|
||||||
(list "--enable-shared" ;allow embedding
|
(list "--enable-shared" ;allow embedding
|
||||||
|
"--with-system-expat" ;for XML support
|
||||||
"--with-system-ffi" ;build ctypes
|
"--with-system-ffi" ;build ctypes
|
||||||
"--with-ensurepip=install" ;install pip and setuptools
|
"--with-ensurepip=install" ;install pip and setuptools
|
||||||
"--enable-unicode=ucs4"
|
"--enable-unicode=ucs4"
|
||||||
|
@ -258,6 +268,7 @@ (define-public python-2.7
|
||||||
#t))))))
|
#t))))))
|
||||||
(inputs
|
(inputs
|
||||||
`(("bzip2" ,bzip2)
|
`(("bzip2" ,bzip2)
|
||||||
|
("expat" ,expat)
|
||||||
("gdbm" ,gdbm)
|
("gdbm" ,gdbm)
|
||||||
("libffi" ,libffi) ; for ctypes
|
("libffi" ,libffi) ; for ctypes
|
||||||
("sqlite" ,sqlite) ; for sqlite extension
|
("sqlite" ,sqlite) ; for sqlite extension
|
||||||
|
@ -311,8 +322,15 @@ (define-public python-3.7
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"1fzi9d2gibh0wzwidyckzbywsxcsbckgsl05ryxlifxia77fhgyq"))
|
"1fzi9d2gibh0wzwidyckzbywsxcsbckgsl05ryxlifxia77fhgyq"))
|
||||||
|
(modules '((guix build utils)))
|
||||||
(snippet
|
(snippet
|
||||||
'(begin
|
'(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
|
(for-each delete-file
|
||||||
'(;; This test may hang and eventually run out of
|
'(;; This test may hang and eventually run out of
|
||||||
;; memory on some systems:
|
;; memory on some systems:
|
||||||
|
@ -379,8 +397,10 @@ (define-public python2-minimal
|
||||||
|
|
||||||
;; Keep zlib, which is used by 'pip' (via the 'zipimport' module), which
|
;; Keep zlib, which is used by 'pip' (via the 'zipimport' module), which
|
||||||
;; is invoked upon 'make install'. 'pip' also expects 'ctypes' and thus
|
;; is invoked upon 'make install'. 'pip' also expects 'ctypes' and thus
|
||||||
;; libffi.
|
;; libffi. Expat is needed for XML support which is expected by a lot
|
||||||
(inputs `(("libffi" ,libffi)
|
;; of libraries out there.
|
||||||
|
(inputs `(("expat" ,expat)
|
||||||
|
("libffi" ,libffi)
|
||||||
("zlib" ,zlib)))))
|
("zlib" ,zlib)))))
|
||||||
|
|
||||||
(define-public python-minimal
|
(define-public python-minimal
|
||||||
|
@ -390,8 +410,10 @@ (define-public python-minimal
|
||||||
|
|
||||||
;; Build fails due to missing ctypes without libffi.
|
;; Build fails due to missing ctypes without libffi.
|
||||||
;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
|
;; OpenSSL is a mandatory dependency of Python 3.x, for urllib;
|
||||||
;; zlib is required by 'zipimport', used by pip.
|
;; zlib is required by 'zipimport', used by pip. Expat is needed
|
||||||
(inputs `(("libffi" ,libffi)
|
;; for XML support, which is generally expected to be available.
|
||||||
|
(inputs `(("expat" ,expat)
|
||||||
|
("libffi" ,libffi)
|
||||||
("openssl" ,openssl)
|
("openssl" ,openssl)
|
||||||
("zlib" ,zlib)))))
|
("zlib" ,zlib)))))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue