summary refs log tree commit diff
path: root/pkgs/development/interpreters/python/cpython/3.5/force_bytecode_determinism.patch
blob: c263cdbff4db8042bd617781fdad4fba1b798eb6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
--- a/Lib/py_compile.py
+++ b/Lib/py_compile.py
@@ -139,3 +139,4 @@
     source_stats = loader.path_stats(file)
+    source_mtime = 1 if 'DETERMINISTIC_BUILD' in os.environ else source_stats['mtime']
     bytecode = importlib._bootstrap_external._code_to_bytecode(
-            code, source_stats['mtime'], source_stats['size'])
+            code, source_mtime, source_stats['size'])
--- a/Lib/importlib/_bootstrap_external.py
+++ b/Lib/importlib/_bootstrap_external.py
@@ -485,5 +485,5 @@
     if source_stats is not None:
         try:
-            source_mtime = int(source_stats['mtime'])
+            source_mtime = 1
         except KeyError:
             pass