mirror of
https://github.com/novatiq/packages.git
synced 2026-04-29 06:58:39 +01:00
python,python3: add support for SOURCE_DATE_EPOCH var
See: https://github.com/openwrt/packages/issues/5278 This should make Python & Python3 packages reproducible when building. In my local tests, I got the same sha256 for a sample .pyc file, so likely this is the solution that should address this. Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
--- a/Lib/py_compile.py
|
||||
+++ b/Lib/py_compile.py
|
||||
@@ -108,6 +108,7 @@ def compile(file, cfile=None, dfile=None, doraise=False):
|
||||
timestamp = long(os.fstat(f.fileno()).st_mtime)
|
||||
except AttributeError:
|
||||
timestamp = long(os.stat(file).st_mtime)
|
||||
+ timestamp = long(os.getenv('SOURCE_DATE_EPOCH', timestamp))
|
||||
codestring = f.read()
|
||||
try:
|
||||
codeobject = __builtin__.compile(codestring, dfile or file,'exec')
|
||||
Reference in New Issue
Block a user