summaryrefslogtreecommitdiff
path: root/guix/build/python-build-system.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/build/python-build-system.scm')
-rw-r--r--guix/build/python-build-system.scm22
1 files changed, 17 insertions, 5 deletions
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index dd07986b94..c0a432038e 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -1,9 +1,10 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013, 2015, 2016, 2018 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
-;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2015, 2018 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
+;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -120,9 +121,9 @@
(format #t "running \"python setup.py\" with command ~s and parameters ~s~%"
command params)
(if use-setuptools?
- (zero? (apply system* "python" "-c" setuptools-shim
- command params))
- (zero? (apply system* "python" "./setup.py" command params))))
+ (apply invoke "python" "-c" setuptools-shim
+ command params)
+ (apply invoke "python" "./setup.py" command params)))
(error "no setup.py found")))
(define* (build #:key use-setuptools? #:allow-other-keys)
@@ -243,10 +244,21 @@ installed with setuptools."
#t))
#t))
+(define* (enable-bytecode-determinism #:rest _)
+ "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.
+ (setenv "PYTHONHASHSEED" "0")
+ #t)
+
(define %standard-phases
;; 'configure' phase is not needed.
(modify-phases gnu:%standard-phases
(add-after 'unpack 'ensure-no-mtimes-pre-1980 ensure-no-mtimes-pre-1980)
+ (add-after 'ensure-no-mtimes-pre-1980 'enable-bytecode-determinism
+ enable-bytecode-determinism)
+ (delete 'bootstrap)
(delete 'configure)
(replace 'install install)
(replace 'check check)