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);
e/gnu/packages/rpc.scm?id=c5e436b0b1a4d2d8637f8f08e662619f3f7fe881'>treecommitdiff
|
Age | Commit message (Expand) | Author |
2021-12-13 | gnu: Simplify package inputs....This commit was obtained by running:
./pre-inst-env guix style
without any additional argument.
| Ludovic Courtès |
2021-11-11 | gnu: abseil-cpp: Update to 20210324.2....But keep the older variant for Tensorflow.
* gnu/packages/cpp.scm (abseil-cpp-20200923.3): Renamed older variant.
(abseil-cpp): New variable.
* gnu/packages/machine-learning.scm (tensorflow-lite)
[inputs]: Adjust to use the older abseil-cpp-20200923.3.
* gnu/packages/rpc.scm (grpc-1.16.1)[native-inputs]: Likewise.
Co-authored-by: Greg Hogan <code@greghogan.com>
| Maxim Cournoyer |
2021-07-04 | gnu: grpc-1.16.1: Build with older protobuf....* gnu/packages/rpc.scm (grpc-1.16.1)[native-inputs]: Replace protobuf
with protobuf-3.6.
| Efraim Flashner |
2021-06-25 | gnu: apache-thrift: Update to 0.14.2....* gnu/packages/rpc.scm (apache-thrift): Update to 0.14.2.
| Tobias Geerinckx-Rice |