at master 1.2 kB view raw
1diff -ur orig/Lib/py_compile.py new/Lib/py_compile.py 2--- orig/Lib/py_compile.py 3+++ new/Lib/py_compile.py 4@@ -122,7 +122,10 @@ 5 cfile = file + (__debug__ and 'c' or 'o') 6 with open(cfile, 'wb') as fc: 7 fc.write('\0\0\0\0') 8- wr_long(fc, timestamp) 9+ if "DETERMINISTIC_BUILD" in os.environ: 10+ fc.write('\0\0\0\0') 11+ else: 12+ wr_long(fc, timestamp) 13 marshal.dump(codeobject, fc) 14 fc.flush() 15 fc.seek(0, 0) 16diff -ur orig/Python/import.c new/Python/import.c 17--- orig/Python/import.c 18+++ new/Python/import.c 19@@ -939,10 +939,12 @@ 20 return; 21 } 22 /* Now write the true mtime (as a 32-bit field) */ 23- fseek(fp, 4L, 0); 24- assert(mtime <= 0xFFFFFFFF); 25- PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); 26- fflush(fp); 27+ if (Py_GETENV("DETERMINISTIC_BUILD") == NULL) { 28+ fseek(fp, 4L, 0); 29+ assert(mtime <= 0xFFFFFFFF); 30+ PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); 31+ fflush(fp); 32+ } 33 fclose(fp); 34 if (Py_VerboseFlag) 35 PySys_WriteStderr("# wrote %s\n", cpathname); 36