summaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/python.scm')
-rw-r--r--gnu/packages/python.scm65
1 files changed, 33 insertions, 32 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 25f2ffa73c..057c47706b 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -3,7 +3,7 @@
;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015, 2016 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
-;;; Copyright © 2014, 2017 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014, 2017, 2019 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2014, 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2015 Omar Radwan <toxemicsquire4@gmail.com>
;;; Copyright © 2015 Pierre-Antoine Rault <par@rigelk.eu>
@@ -95,7 +95,6 @@
(package
(name "python2")
(version "2.7.15")
- (replacement python-2/fixed)
(source
(origin
(method url-fetch)
@@ -108,7 +107,9 @@
"python-2-deterministic-build-info.patch"
"python-2.7-site-prefixes.patch"
"python-2.7-source-date-epoch.patch"
- "python-2.7-adjust-tests.patch"))
+ "python-2.7-adjust-tests.patch"
+ "python2-CVE-2018-14647.patch"
+ "python2-CVE-2018-1000802.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
@@ -136,6 +137,9 @@
"--enable-unicode=ucs4"
(string-append "LDFLAGS=-Wl,-rpath="
(assoc-ref %outputs "out") "/lib"))
+ ;; With no -j argument tests use all available cpus, so provide one.
+ #:make-flags
+ (list (format #f "TESTOPTS=-j~d" (parallel-job-count)))
#:modules ((ice-9 ftw) (ice-9 match)
(guix build utils) (guix build gnu-build-system))
@@ -204,16 +208,35 @@
(scandir testdir
(match-lambda
((or "." "..") #f)
+ ("support" #f)
(file
(not
- ;; FIXME: Add the 'support' directory
- ;; in the next rebuild cycle, since it
- ;; moved in 2.7.14. See also
- ;; python2-futures below.
(string-prefix? "test_support."
file))))))
(call-with-output-file "__init__.py" (const #t))
#t)))))))
+ (add-after 'remove-tests 'rebuild-bytecode
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ ;; Disable hash randomization to ensure the generated .pycs
+ ;; are reproducible.
+ (setenv "PYTHONHASHSEED" "0")
+ (for-each
+ (lambda (opt)
+ (format #t "Compiling with optimization level: ~a\n"
+ (if (null? opt) "none" (car opt)))
+ (for-each (lambda (file)
+ (apply invoke
+ `(,(string-append out "/bin/python")
+ ,@opt
+ "-m" "compileall"
+ "-f" ; force rebuild
+ ;; Don't build lib2to3, because it contains Python 3 code.
+ "-x" "lib2to3/.*"
+ ,file)))
+ (find-files out "\\.py$")))
+ (list '() '("-O") '("-OO")))
+ #t)))
(add-after 'install 'move-tk-inter
(lambda* (#:key outputs #:allow-other-keys)
;; When Tkinter support is built move it to a separate output so
@@ -266,16 +289,6 @@ data types.")
;; Current 2.x version.
(define-public python-2 python-2.7)
-(define python-2/fixed
- (package
- (inherit python-2)
- (source (origin
- (inherit (package-source python-2))
- (patches (append
- (origin-patches (package-source python-2))
- (search-patches "python2-CVE-2018-14647.patch"
- "python2-CVE-2018-1000802.patch")))))))
-
(define-public python2-called-python
;; Both 2.x and 3.x used to be called "python". In commit
;; a7714d42de2c3082f3609d1e63c83d703fb39cf9 (March 2018), we renamed the
@@ -288,8 +301,7 @@ data types.")
(define-public python-3.7
(package (inherit python-2)
(name "python")
- (version "3.7.0")
- (replacement python-3/fixed)
+ (version "3.7.2")
(source (origin
(method url-fetch)
(uri (string-append "https://www.python.org/ftp/python/"
@@ -302,7 +314,7 @@ data types.")
(patch-flags '("-p0"))
(sha256
(base32
- "0j9mic5c9lbd2b20wka7hily7szz740wy9ilfrczxap63rnrk0h3"))
+ "1fzi9d2gibh0wzwidyckzbywsxcsbckgsl05ryxlifxia77fhgyq"))
(snippet
'(begin
(for-each delete-file
@@ -326,10 +338,7 @@ data types.")
(lambda _ (unsetenv "SOURCE_DATE_EPOCH") #t))
(add-after 'check 'reset-SOURCE_DATE_EPOCH
(lambda _ (setenv "SOURCE_DATE_EPOCH" "1") #t))
- ;; FIXME: Without this phase we have close to 400 files that
- ;; differ across different builds of this package. With this phase
- ;; there are 44 files left that differ.
- (add-after 'remove-tests 'rebuild-bytecode
+ (replace 'rebuild-bytecode
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
;; Disable hash randomization to ensure the generated .pycs
@@ -361,14 +370,6 @@ data types.")
;; Current 3.x version.
(define-public python-3 python-3.7)
-(define python-3/fixed
- (package
- (inherit python-3)
- (source (origin
- (inherit (package-source python-3))
- (patches (append (origin-patches (package-source python-3))
- (search-patches "python-CVE-2018-14647.patch")))))))
-
;; Current major version.
(define-public python python-3)