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);
href='/guix/tree/gnu/installer/connman.scm?id=31a1e7d375cd554149bac83e5acaaf0ef63b65b6'>treecommitdiff
|
Age | Commit message (Expand) | Author |
xpand)Author |
2024-04-13 | gnu: Add gnudatalanguage....* gnu/packages/data-language.scm: New file.
* gnu/packages/data-language.scm (gnudatalanguage): New variable.
* gnu/local.mk: Add gnu/packages/data-language.scm to scope.
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Change-Id: Icf830df85ed8e6f067344af96dbb7d202e677dee
| Antero Mejr |