gnu: python: Update to 3.7.0.
* gnu/packages/python.scm (python-3.6): Rename to ... (python-3.7): ... this. Update to 3.7.0. [arguments]: Remove phase 'patch-timestamp-for-pyc-files' and related code. Add phases to unset SOURCE_DATE_EPOCH during the check phase. (python-3): Is now PYTHON-3.7. * guix/build/python-build-system.scm (enable-bytecode-determinism): Don't set DETERMINISTIC_BUILD.
This commit is contained in:
parent
d66146073d
commit
a1454169e0
|
@ -321,10 +321,10 @@ data types.")
|
||||||
(name "python")
|
(name "python")
|
||||||
(properties `((superseded . ,python-2)))))
|
(properties `((superseded . ,python-2)))))
|
||||||
|
|
||||||
(define-public python-3.6
|
(define-public python-3.7
|
||||||
(package (inherit python-2)
|
(package (inherit python-2)
|
||||||
(name "python")
|
(name "python")
|
||||||
(version "3.6.5")
|
(version "3.7.0")
|
||||||
(source (origin
|
(source (origin
|
||||||
(method url-fetch)
|
(method url-fetch)
|
||||||
(uri (string-append "https://www.python.org/ftp/python/"
|
(uri (string-append "https://www.python.org/ftp/python/"
|
||||||
|
@ -337,7 +337,7 @@ data types.")
|
||||||
(patch-flags '("-p0"))
|
(patch-flags '("-p0"))
|
||||||
(sha256
|
(sha256
|
||||||
(base32
|
(base32
|
||||||
"19l7inxm056jjw33zz97z0m02hsi7jnnx5kyb76abj5ml4xhad7l"))
|
"0j9mic5c9lbd2b20wka7hily7szz740wy9ilfrczxap63rnrk0h3"))
|
||||||
(snippet
|
(snippet
|
||||||
'(begin
|
'(begin
|
||||||
(for-each delete-file
|
(for-each delete-file
|
||||||
|
@ -349,52 +349,17 @@ data types.")
|
||||||
(substitute-keyword-arguments (package-arguments python-2)
|
(substitute-keyword-arguments (package-arguments python-2)
|
||||||
((#:phases phases)
|
((#:phases phases)
|
||||||
`(modify-phases ,phases
|
`(modify-phases ,phases
|
||||||
(add-after 'unpack 'patch-timestamp-for-pyc-files
|
;; Unset SOURCE_DATE_EPOCH while running the test-suite and set it
|
||||||
(lambda _
|
;; again afterwards. See <https://bugs.python.org/issue34022>.
|
||||||
;; We set DETERMINISTIC_BUILD to only override the mtime when
|
(add-before 'check 'unset-SOURCE_DATE_EPOCH
|
||||||
;; building with Guix, lest we break auto-compilation in
|
(lambda _ (unsetenv "SOURCE_DATE_EPOCH") #t))
|
||||||
;; environments.
|
(add-after 'check 'reset-SOURCE_DATE_EPOCH
|
||||||
(setenv "DETERMINISTIC_BUILD" "1")
|
(lambda _ (setenv "SOURCE_DATE_EPOCH" "1") #t))
|
||||||
(substitute* "Lib/py_compile.py"
|
;; FIXME: Without this phase we have close to 400 files that
|
||||||
(("source_stats\\['mtime'\\]")
|
|
||||||
"(1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime'])"))
|
|
||||||
|
|
||||||
;; Use deterministic hashes for strings, bytes, and datetime
|
|
||||||
;; objects.
|
|
||||||
(setenv "PYTHONHASHSEED" "0")
|
|
||||||
|
|
||||||
;; Reset mtime when validating bytecode header.
|
|
||||||
(substitute* "Lib/importlib/_bootstrap_external.py"
|
|
||||||
(("source_mtime = int\\(source_stats\\['mtime'\\]\\)")
|
|
||||||
"source_mtime = 1"))
|
|
||||||
#t))
|
|
||||||
;; These tests fail because of our change to the bytecode
|
|
||||||
;; validation. They fail because expected exceptions do not get
|
|
||||||
;; thrown. This seems to be no problem.
|
|
||||||
(add-after 'unpack 'disable-broken-bytecode-tests
|
|
||||||
(lambda _
|
|
||||||
(substitute* "Lib/test/test_importlib/source/test_file_loader.py"
|
|
||||||
(("test_bad_marshal")
|
|
||||||
"disable_test_bad_marshal")
|
|
||||||
(("test_no_marshal")
|
|
||||||
"disable_test_no_marshal")
|
|
||||||
(("test_non_code_marshal")
|
|
||||||
"disable_test_non_code_marshal"))
|
|
||||||
#t))
|
|
||||||
;; Unset DETERMINISTIC_BUILD to allow for tests that check that
|
|
||||||
;; stale pyc files are rebuilt.
|
|
||||||
(add-before 'check 'allow-non-deterministic-compilation
|
|
||||||
(lambda _ (unsetenv "DETERMINISTIC_BUILD") #t))
|
|
||||||
;; We need to rebuild all pyc files for three different
|
|
||||||
;; optimization levels to replace all files that were not built
|
|
||||||
;; deterministically.
|
|
||||||
|
|
||||||
;; FIXME: Without this phase we have close to 2000 files that
|
|
||||||
;; differ across different builds of this package. With this phase
|
;; differ across different builds of this package. With this phase
|
||||||
;; there are about 500 files left that differ.
|
;; there are 44 files left that differ.
|
||||||
(add-after 'install 'rebuild-bytecode
|
(add-after 'install 'rebuild-bytecode
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(setenv "DETERMINISTIC_BUILD" "1")
|
|
||||||
(let ((out (assoc-ref outputs "out")))
|
(let ((out (assoc-ref outputs "out")))
|
||||||
(for-each
|
(for-each
|
||||||
(lambda (opt)
|
(lambda (opt)
|
||||||
|
@ -421,7 +386,7 @@ data types.")
|
||||||
"/site-packages"))))))))
|
"/site-packages"))))))))
|
||||||
|
|
||||||
;; Current 3.x version.
|
;; Current 3.x version.
|
||||||
(define-public python-3 python-3.6)
|
(define-public python-3 python-3.7)
|
||||||
|
|
||||||
;; Current major version.
|
;; Current major version.
|
||||||
(define-public python python-3)
|
(define-public python python-3)
|
||||||
|
|
|
@ -246,8 +246,6 @@ installed with setuptools."
|
||||||
|
|
||||||
(define* (enable-bytecode-determinism #:rest _)
|
(define* (enable-bytecode-determinism #:rest _)
|
||||||
"Improve determinism of pyc files."
|
"Improve determinism of pyc files."
|
||||||
;; Set DETERMINISTIC_BUILD to override the embedded mtime in pyc files.
|
|
||||||
(setenv "DETERMINISTIC_BUILD" "1")
|
|
||||||
;; Use deterministic hashes for strings, bytes, and datetime objects.
|
;; Use deterministic hashes for strings, bytes, and datetime objects.
|
||||||
(setenv "PYTHONHASHSEED" "0")
|
(setenv "PYTHONHASHSEED" "0")
|
||||||
#t)
|
#t)
|
||||||
|
|
Loading…
Reference in New Issue