summaryrefslogtreecommitdiff
path: root/lang/python
diff options
context:
space:
mode:
authorHannu Nyman <hannu.nyman@iki.fi>2017-12-31 10:56:39 +0200
committerGitHub <noreply@github.com>2017-12-31 10:56:39 +0200
commit750f19ab2621ca6d8a1d0db61b8bf3daf88266b5 (patch)
tree232b12c6a45a53aa7f198de0837feae983fe52fb /lang/python
parent506c4947ae877c3bfa2eba1dedfbf94e4d531efb (diff)
parent1b6dd4781f901a769718c49f6f255c15fd376f6e (diff)
Merge pull request #5303 from commodo/python-source-date-epoch
python,python3: add support for SOURCE_DATE_EPOCH var
Diffstat (limited to 'lang/python')
-rw-r--r--lang/python/python/Makefile2
-rw-r--r--lang/python/python/patches/012-add-support-source-date-epoch-pyc.patch10
-rw-r--r--lang/python/python3/Makefile2
-rw-r--r--lang/python/python3/patches/012-add-support-source-date-epoch-pyc.patch13
4 files changed, 25 insertions, 2 deletions
diff --git a/lang/python/python/Makefile b/lang/python/python/Makefile
index 0e0ffc25c..b1bccfc8e 100644
--- a/lang/python/python/Makefile
+++ b/lang/python/python/Makefile
@@ -14,7 +14,7 @@ PKG_NAME:=python
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
# XXX: reset PKG_RELEASE to 1 only if Python's pip & setuptools versions have also bumped;
# otherwise, keep bumping PKG_RELEASE
-PKG_RELEASE:=5
+PKG_RELEASE:=6
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
diff --git a/lang/python/python/patches/012-add-support-source-date-epoch-pyc.patch b/lang/python/python/patches/012-add-support-source-date-epoch-pyc.patch
new file mode 100644
index 000000000..6f33bed1e
--- /dev/null
+++ b/lang/python/python/patches/012-add-support-source-date-epoch-pyc.patch
@@ -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')
diff --git a/lang/python/python3/Makefile b/lang/python/python3/Makefile
index 924fec58f..b5d9cf46f 100644
--- a/lang/python/python3/Makefile
+++ b/lang/python/python3/Makefile
@@ -16,7 +16,7 @@ PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
PKG_NAME:=python3
# XXX: reset PKG_RELEASE to 1 only if Python's pip & setuptools versions have also bumped;
# otherwise, keep bumping PKG_RELEASE
-PKG_RELEASE:=11
+PKG_RELEASE:=12
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
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