aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarius Bakke <marius@gnu.org>2021-07-22 00:05:45 +0200
committerMarius Bakke <marius@gnu.org>2021-07-23 17:26:47 +0200
commit65c5efd14e57afbc8152cadf09fc30076c60532a (patch)
treed52786c601122db2c8d5f33b4292ed80c3db8af7
parent7c2c69886275895f6030b47c76078abfe62edf82 (diff)
downloadguix-65c5efd14e57afbc8152cadf09fc30076c60532a.tar.gz
guix-65c5efd14e57afbc8152cadf09fc30076c60532a.zip
gnu: Python: Delete existing compiled files before compiling bytecode.
* gnu/packages/python.scm (python-3.9)[arguments]: Delete existing pycs before calling "compileall".
-rw-r--r--gnu/packages/python.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 0b763af924..8a8fe2bd2a 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -533,6 +533,14 @@ data types.")
;; Disable hash randomization to ensure the generated .pycs
;; are reproducible.
(setenv "PYTHONHASHSEED" "0")
+
+ ;; XXX: Delete existing auto-generated pycs beforehand because
+ ;; the -f argument does not necessarily overwrite all files,
+ ;; leading to indeterministic results.
+ (for-each (lambda (pyc)
+ (delete-file pyc))
+ (find-files out "\\.pyc$"))
+
(apply invoke
`(,,(if (%current-target-system)
"python3"