summaryrefslogtreecommitdiff
path: root/gnu/packages/python.scm
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/packages/python.scm
parentea562aba69d8ef8599abdaf2505e3f1f7ecf4d28 (diff)
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/packages/python.scm')
-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 0ec790223e9..0b763af9243 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -533,23 +533,18 @@ data types.")
533 ;; Disable hash randomization to ensure the generated .pycs 533 ;; Disable hash randomization to ensure the generated .pycs
534 ;; are reproducible. 534 ;; are reproducible.
535 (setenv "PYTHONHASHSEED" "0") 535 (setenv "PYTHONHASHSEED" "0")
536 (for-each 536 (apply invoke
537 (lambda (opt) 537 `(,,(if (%current-target-system)
538 (format #t "Compiling with optimization level: ~a\n" opt) 538 "python3"
539 (lambda (file) 539 '(string-append out
540 (apply invoke 540 "/bin/python3"))
541 `(,,(if (%current-target-system) 541 "-m" "compileall"
542 "python3" 542 "-o" "0" "-o" "1" "-o" "2"
543 '(string-append out 543 "-f" ; force rebuild
544 "/bin/python3")) 544 "--invalidation-mode=unchecked-hash"
545 ,opt 545 ;; Don't build lib2to3, because it's Python 2 code.
546 "-m" "compileall" 546 "-x" "lib2to3/.*"
547 "-f" ; force rebuild 547 ,out)))))
548 "--invalidation-mode=unchecked-hash"
549 ;; Don't build lib2to3, because it's Python 2 code.
550 "-x" "lib2to3/.*"
551 ,out))))
552 (list "none" "-O" "-OO")))))
553 (replace 'install-sitecustomize.py 548 (replace 'install-sitecustomize.py
554 ,(customize-site version)))))) 549 ,(customize-site version))))))
555 (native-inputs 550 (native-inputs