From 1b6dd4781f901a769718c49f6f255c15fd376f6e Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Tue, 19 Dec 2017 22:29:52 +0200 Subject: 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 --- .../patches/012-add-support-source-date-epoch-pyc.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 lang/python/python3/patches/012-add-support-source-date-epoch-pyc.patch (limited to 'lang/python/python3/patches') diff --git a/lang/python/python3/patches/012-add-support-source-date-epoch-pyc.patch b/lang/python/python3/patches/012-add-support-source-date-epoch-pyc.patch new file mode 100644 index 000000000..4c2c2f7cd --- /dev/null +++ b/lang/python/python3/patches/012-add-support-source-date-epoch-pyc.patch @@ -0,0 +1,13 @@ +--- a/Lib/py_compile.py ++++ b/Lib/py_compile.py +@@ -137,8 +137,9 @@ def compile(file, cfile=None, dfile=None + except FileExistsError: + pass + source_stats = loader.path_stats(file) ++ mtime = int(os.getenv('SOURCE_DATE_EPOCH', source_stats['mtime'])) + bytecode = importlib._bootstrap_external._code_to_bytecode( +- code, source_stats['mtime'], source_stats['size']) ++ code, mtime, source_stats['size']) + mode = importlib._bootstrap_external._calc_mode(file) + importlib._bootstrap_external._write_atomic(cfile, bytecode, mode) + return cfile -- cgit