summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/cpython/2.7/default.nix
diff options
context:
space:
mode:
authorFrederik Rietdijk <fridh@fridh.nl>2017-02-08 23:54:44 +0100
committerFrederik Rietdijk <fridh@fridh.nl>2017-02-26 14:50:09 +0100
commit09f6b03b2e15d267303d4086f85b21fe498f3267 (patch)
tree5cc81f8b80b073bc78a7568ad9434c1fd155f710 /pkgs/development/interpreters/python/cpython/2.7/default.nix
parentf157956266457581dbe62ba872d37420a529924c (diff)
Python 2.7: improve determinism
There is some randomness in the Windows installers. Since we don't need
them, we delete them.
Diffstat (limited to 'pkgs/development/interpreters/python/cpython/2.7/default.nix')
-rw-r--r--pkgs/development/interpreters/python/cpython/2.7/default.nix11
1 files changed, 11 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/python/cpython/2.7/default.nix b/pkgs/development/interpreters/python/cpython/2.7/default.nix
index ccf9296e0bcb3..0f09bf7650bf0 100644
--- a/pkgs/development/interpreters/python/cpython/2.7/default.nix
+++ b/pkgs/development/interpreters/python/cpython/2.7/default.nix
@@ -178,6 +178,17 @@ in stdenv.mkDerivation {
         echo "manylinux1_compatible=False" >> $out/lib/${libPrefix}/_manylinux.py
 
         rm "$out"/lib/python*/plat-*/regen # refers to glibc.dev
+
+        # Determinism: Windows installers were not deterministic.
+        # We're also not interested in building Windows installers.
+        find "$out" -name 'wininst*.exe' | xargs -r rm -f
+
+        # Determinism: rebuild all bytecode
+        # We exclude lib2to3 because that's Python 2 code which fails
+        # We rebuild three times, once for each optimization level
+        find $out -name "*.py" | $out/bin/python -m compileall -q -f -x "lib2to3" -i -
+        find $out -name "*.py" | $out/bin/python -O -m compileall -q -f -x "lib2to3" -i -
+        find $out -name "*.py" | $out/bin/python -OO -m compileall -q -f -x "lib2to3" -i -
       '';
 
     passthru = let