summaryrefslogtreecommitdiff
path: root/lang/python
diff options
context:
space:
mode:
authorNj Hsiong <nj.hsiong@gmail.com>2019-01-09 19:43:22 +0800
committerNj Hsiong <nj.hsiong@gmail.com>2019-01-09 22:06:52 +0800
commitc98b12d9a920ede376d1eaef0da0c0da9d26d6b3 (patch)
treedb9291213bf0fb6734a0e45033cfa094c87a19dd /lang/python
parent8cfbcfd7570a023dfac81f6678256dd8968b5c67 (diff)
python3: enable lib2to3 to also search and fix .pyc files.
python3's lib2to3 would fail in silence if python3 and its packages are installed as compiled .pyc files. Root cause is, in Lib/lib2to3/refactor.py, the function get_all_fix_names only searches '.py' fix names. Signed-off-by: Nj Hsiong <nj.hsiong@gmail.com>
Diffstat (limited to 'lang/python')
-rw-r--r--lang/python/python3/Makefile2
-rw-r--r--lang/python/python3/patches/017_lib2to3_fix_pyc_search.patch17
2 files changed, 18 insertions, 1 deletions
diff --git a/lang/python/python3/Makefile b/lang/python/python3/Makefile
index e4116e27d..2d950db60 100644
--- a/lang/python/python3/Makefile
+++ b/lang/python/python3/Makefile
@@ -14,7 +14,7 @@ PYTHON_VERSION:=$(PYTHON3_VERSION)
PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
PKG_NAME:=python3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
diff --git a/lang/python/python3/patches/017_lib2to3_fix_pyc_search.patch b/lang/python/python3/patches/017_lib2to3_fix_pyc_search.patch
new file mode 100644
index 000000000..5972914bd
--- /dev/null
+++ b/lang/python/python3/patches/017_lib2to3_fix_pyc_search.patch
@@ -0,0 +1,17 @@
+diff --git a/Lib/lib2to3/refactor.py b/Lib/lib2to3/refactor.py
+index 7841b99..1e0d3b3 100644
+--- a/Lib/lib2to3/refactor.py
++++ b/Lib/lib2to3/refactor.py
+@@ -37,6 +37,12 @@ def get_all_fix_names(fixer_pkg, remove_prefix=True):
+ if remove_prefix:
+ name = name[4:]
+ fix_names.append(name[:-3])
++ if name.startswith("fix_") and name.endswith(".pyc"):
++ if remove_prefix:
++ name = name[4:]
++ name = name[:-4]
++ if name not in fix_names:
++ fix_names.append(name)
+ return fix_names
+
+