summaryrefslogtreecommitdiffstats
path: root/package/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch
diff options
context:
space:
mode:
authorAndrey Smirnov <andrew.smirnov@gmail.com>2017-03-23 08:21:12 -0700
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2017-03-25 15:18:49 +0100
commitd2afa01f76ce2c7610286103340048d953b27e45 (patch)
tree5fffb2d070841068df535c03449c11a15e43318e /package/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch
parentf48f1a89a0c598ebefd2643af3ad6aff981e291c (diff)
downloadbuildroot-d2afa01f76ce2c7610286103340048d953b27e45.tar.gz
buildroot-d2afa01f76ce2c7610286103340048d953b27e45.zip
python3: Bump version to 3.6.1
Update all appropriate version numbers as well as SHAs and MD5s as well as repbasing BR's patches on top of 3.6.1 codebase (new github repo tree, v3.6.1 tag was used). Note that patch: [PATCH] Change the install location of _sysconfigdata.py was dropped due to the fact taht build system now adds platform specific suffix to sysconfigdata's name, so each platform's file should have a unique name and distutils now allows to specify which sysconfigdata is used via _PYTHON_SYSCONFIGDATA_NAME see: https://github.com/python/cpython/commit/c4b53afce491142b80b228a21a05de5dcfd8d36f https://github.com/python/cpython/commit/92dec548ff1494b86f08bd3753ca91a9330b4ea9 and patches: [PATCH] distutils/sysconfig: use sysconfigdata [PATCH] setup.py: do not add invalid header locations [PATCH] Do not harcode invalid path to ncursesw headers was dropped since it looks like it made it's way upstream, see: https://github.com/python/cpython/commit/409482251b06fe75c4ee56e85ffbb4b23d934159 https://github.com/python/cpython/commit/1351c31aa9651b278d7ef8ec79af3b646a520235 https://github.com/python/cpython/commit/e13c3201fb66c4c211b4ebb7604d1435bedc1015 respectively. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch')
-rw-r--r--package/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/package/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch b/package/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch
new file mode 100644
index 0000000000..b929fa36d1
--- /dev/null
+++ b/package/python3/0012-Add-importlib-fix-for-PEP-3147-issue.patch
@@ -0,0 +1,99 @@
+From 7615840f2298aedc990db3d9be2badb19294a807 Mon Sep 17 00:00:00 2001
+From: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
+Date: Wed, 22 Feb 2017 16:48:49 -0800
+Subject: [PATCH] Add importlib fix for PEP 3147 issue
+
+Python 3 has a new standard for installing .pyc file, called PEP
+3147. Unfortunately, this standard requires both the .py and .pyc
+files to be installed for a Python module to be found. This is quite
+annoying on space-constrained embedded systems, since the .py file is
+technically not required for execution.
+
+This patch changes cache_from_source() and source_from_cache() in
+importlib to get rid of the "__pycache__" directory.
+This effectively disables PEP 3147 for:
+
+* The python standard library
+* Packages built with distutils or setuptools
+* Packages built with automake that use the `py-compile` helper
+
+Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm>
+[ Andrey Smirnov: ported to Python 3.6 ]
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+---
+ Lib/importlib/_bootstrap_external.py | 38 +++++-------------------------------
+ 1 file changed, 5 insertions(+), 33 deletions(-)
+
+diff --git a/Lib/importlib/_bootstrap_external.py b/Lib/importlib/_bootstrap_external.py
+index 9feec50..3550013 100644
+--- a/Lib/importlib/_bootstrap_external.py
++++ b/Lib/importlib/_bootstrap_external.py
+@@ -275,8 +275,6 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
+ a True value is the same as setting 'optimization' to the empty string
+ while a False value is equivalent to setting 'optimization' to '1'.
+
+- If sys.implementation.cache_tag is None then NotImplementedError is raised.
+-
+ """
+ if debug_override is not None:
+ _warnings.warn('the debug_override parameter is deprecated; use '
+@@ -288,10 +286,7 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
+ path = _os.fspath(path)
+ head, tail = _path_split(path)
+ base, sep, rest = tail.rpartition('.')
+- tag = sys.implementation.cache_tag
+- if tag is None:
+- raise NotImplementedError('sys.implementation.cache_tag is None')
+- almost_filename = ''.join([(base if base else rest), sep, tag])
++ almost_filename = ''.join([(base if base else rest)])
+ if optimization is None:
+ if sys.flags.optimize == 0:
+ optimization = ''
+@@ -302,40 +297,17 @@ def cache_from_source(path, debug_override=None, *, optimization=None):
+ if not optimization.isalnum():
+ raise ValueError('{!r} is not alphanumeric'.format(optimization))
+ almost_filename = '{}.{}{}'.format(almost_filename, _OPT, optimization)
+- return _path_join(head, _PYCACHE, almost_filename + BYTECODE_SUFFIXES[0])
++ return _path_join(head, almost_filename + BYTECODE_SUFFIXES[0])
+
+
+ def source_from_cache(path):
+ """Given the path to a .pyc. file, return the path to its .py file.
+
+ The .pyc file does not need to exist; this simply returns the path to
+- the .py file calculated to correspond to the .pyc file. If path does
+- not conform to PEP 3147/488 format, ValueError will be raised. If
+- sys.implementation.cache_tag is None then NotImplementedError is raised.
+-
++ the .py file calculated to correspond to the .pyc file.
+ """
+- if sys.implementation.cache_tag is None:
+- raise NotImplementedError('sys.implementation.cache_tag is None')
+- path = _os.fspath(path)
+- head, pycache_filename = _path_split(path)
+- head, pycache = _path_split(head)
+- if pycache != _PYCACHE:
+- raise ValueError('{} not bottom-level directory in '
+- '{!r}'.format(_PYCACHE, path))
+- dot_count = pycache_filename.count('.')
+- if dot_count not in {2, 3}:
+- raise ValueError('expected only 2 or 3 dots in '
+- '{!r}'.format(pycache_filename))
+- elif dot_count == 3:
+- optimization = pycache_filename.rsplit('.', 2)[-2]
+- if not optimization.startswith(_OPT):
+- raise ValueError("optimization portion of filename does not start "
+- "with {!r}".format(_OPT))
+- opt_level = optimization[len(_OPT):]
+- if not opt_level.isalnum():
+- raise ValueError("optimization level {!r} is not an alphanumeric "
+- "value".format(optimization))
+- base_filename = pycache_filename.partition('.')[0]
++ head, filename = _path_split(path)
++ base_filename = filename.partition('.')[0]
+ return _path_join(head, base_filename + SOURCE_SUFFIXES[0])
+
+
+--
+2.9.3
+
OpenPOWER on IntegriCloud