Honor the 'SOURCE_DATE_EPOCH' environment variable to allow for determinitic builds. --- a/Lib/py_compile.py +++ b/Lib/py_compile.py @@ -105,7 +105,10 @@ def compile(file, cfile=None, dfile=None, doraise=False): """ with open(file, 'U') as f: try: - timestamp = long(os.fstat(f.fileno()).st_mtime) + if 'SOURCE_DATE_EPOCH' in os.environ: + timestamp = long(os.environ['SOURCE_DATE_EPOCH']) + else: + timestamp = long(os.fstat(f.fileno()).st_mtime) except AttributeError: timestamp = long(os.stat(file).st_mtime) codestring = f.read() diff --git a/Python/import.c b/Python/import.c index e47ce63..7eecf9c 100644 --- a/Python/import.c +++ b/Python/import.c @@ -945,6 +945,11 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, t /* Now write the true mtime (as a 32-bit field) */ fseek(fp, 4L, 0); assert(mtime <= 0xFFFFFFFF); + if (Py_GETENV("SOURCE_DATE_EPOCH") != NULL) { + const char *epoch = Py_GETENV("SOURCE_DATE_EPOCH"); + mtime = atoi(epoch); + } + PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); fflush(fp); fclose(fp); ix/tree/gnu/packages/guile.scm?id=eab88f2e458035560310f5dd2be92ee47183f8b9'>treecommitdiff
path: root/gnu/packages/guile.scm
AgeCommit message (Expand)Author
2024-01-29gnu: guile-next: Update to commit fb1f5e2....* gnu/packages/guile.scm (guile-next): Update to commit fb1f5e2. Change-Id: Ia699bf7bf950b8780366146508eec566a738fb80 David Thompson
2023-11-28gnu: guile-next: Update to commit d8df317....* gnu/packages/guile.scm (guile-next): Update to commit d8df317. Change-Id: I80efe5221183f694f3e7ff85232dcce136a30ccb David Thompson
2023-10-13gnu: guile-next: Update to 3.0.9-0.79e836b....* gnu/packages/guile.scm (guile-next): Update to 3.0.9-0.79e836b. David Thompson
2023-09-01gnu: guile-next: Update to c2cba86....* gnu/packages/guile.scm (guile-next): Update to c2cba86. Janneke Nieuwenhuizen