aboutsummaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2021-07-22 00:01:05 +0200
committerMarius Bakke <marius@gnu.org>2021-07-23 17:26:46 +0200
commit7c2c69886275895f6030b47c76078abfe62edf82 (patch)
tree61f9a32cd9be0b8e3ce6c64153ae4a7793150e7d /gnu
parentea562aba69d8ef8599abdaf2505e3f1f7ecf4d28 (diff)
downloadguix-7c2c69886275895f6030b47c76078abfe62edf82.tar.gz
guix-7c2c69886275895f6030b47c76078abfe62edf82.zip
gnu: Python: Fix bytecode compilation.
* gnu/packages/python.scm (python-3.9)[arguments]: In the rebuild-bytecode phase, actully run Python instead of defining an anonymous procedure. While at it, create all optimization levels with the same command instead of running once for each level.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python.scm29
1 files changed, 12 insertions, 17 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 0ec790223e..0b763af924 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -533,23 +533,18 @@ data types.")
;; 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" opt)
- (lambda (file)
- (apply invoke
- `(,,(if (%current-target-system)
- "python3"
- '(string-append out
- "/bin/python3"))
- ,opt
- "-m" "compileall"
- "-f" ; force rebuild
- "--invalidation-mode=unchecked-hash"
- ;; Don't build lib2to3, because it's Python 2 code.
- "-x" "lib2to3/.*"
- ,out))))
- (list "none" "-O" "-OO")))))
+ (apply invoke
+ `(,,(if (%current-target-system)
+ "python3"
+ '(string-append out
+ "/bin/python3"))
+ "-m" "compileall"
+ "-o" "0" "-o" "1" "-o" "2"
+ "-f" ; force rebuild
+ "--invalidation-mode=unchecked-hash"
+ ;; Don't build lib2to3, because it's Python 2 code.
+ "-x" "lib2to3/.*"
+ ,out)))))
(replace 'install-sitecustomize.py
,(customize-site version))))))
(native-inputs