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);
b1a437f847b4cbf228fcc13cc3624e89d2'>treecommitdiff
|
Age | Commit message (Expand) | Author |
2022-05-12 | snippets: Add a 'remove' snippet....* etc/snippets/text-mode/guix-commit-message-remove-package: New file.
| Maxim Cournoyer |
2022-01-19 | etc: Match define-public only at line start....The current regexp simply matches the first occurence, which more often than
not points to the *previous* variable.
* etc/snippets/text-mode/guix-commit-message-update-package ($1): Restrict
match to beginning of line with optional indentation.
| Liliana Marie Prikler |
2021-06-26 | etc: snippets: Use ‘hg-file-name’ when origin uses ‘hg-fetch’...Adjust to changes in commit aaafd19bd1e37265de07e246286a6819792c25b4.
* etc/snippets/scheme-mode/guix-origin: Use ‘hg-file-name’ instead of
‘string-append’ when ‘method’ for origin is ‘hg-fetch’.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| Xinglu Chen |
2020-12-23 | etc: snippets: Add new build systems to package snippet....* etc/snippets/scheme-mode/guix-package: Add the following as possibilities
for the build-system field:
clojure-build-system
copy-build-system
dune-build-system
guile-build-system
julia-build-system
linux-module-build-system
maven-build-system
node-build-system
qt-build-system
rakudo-build-system
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| Morgan Smith |
2020-12-04 | etc: snippets: Fix name extraction....* etc/snippets/text-mode/guix-commit-message-add-package: Fix name
extraction. This is a follow-up to 988a49c78ef19ad25cef543e2059a19db04bbd36.
| Nicolas Goaziou |
2020-12-04 | etc: snippets: Fix name extraction....* etc/snippets/text-mode/guix-commit-message-update-package: Since git commit
mode is not derived from any Lisp mode, so-called sexp or symbols do not
include the period character. As a consequence, names including versions are
not properly extracted. Also use more idiomatic (goto-char (point-min))
instead of (beginning-of-buffer).
| Nicolas Goaziou |
2020-11-25 | etc: snippets: Fix "gnu: Add ..." name when prefilling Common Lisp commits me......* etc/snippets/text-mode/guix-commit-message-add-cl-package: Fix name and
simplify the "New variables" line.
| Pierre Neidhardt |
2020-11-23 | etc: snippets: Prefill Common Lisp package names....* etc/snippets/text-mode/guix-commit-message-add-cl-package: New file.
| Pierre Neidhardt |
2020-11-23 | etc: snippets: Fix package name extraction....* etc/snippets/text-mode/guix-commit-message-add-package: Properly extract
name when the diff contains a very short `define-public ...` above the actual
new package. This can happen when the above package is a small inherited
definition or cl/ecl package.
| Pierre Neidhardt |