gnu: python: Build reproducibly.

\o/

* gnu/packages/python.scm (python-3.7)[arguments]: Set PYTHONHASHSEED before
rebuilding all bytecode.  Adjust regex so that lib2to3_ex.py gets compiled.
This commit is contained in:
Marius Bakke 2018-07-23 20:53:50 +02:00
parent 81d967075e
commit a422e2478e
No known key found for this signature in database
GPG key ID: A2A06DF2A33A54FA

View file

@ -361,6 +361,9 @@ (define-public python-3.7
(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"
@ -372,7 +375,7 @@ (define-public python-3.7
"-m" "compileall"
"-f" ; force rebuild
;; Don't build lib2to3, because it's Python 2 code.
"-x" "lib2to3.*"
"-x" "lib2to3/.*"
,file)))
(find-files out "\\.py$")))
(list '() '("-O") '("-OO")))