python: Fix lib2to3 fixes search
authorJeffery To <jeffery.to@gmail.com>
Sat, 12 Jan 2019 21:59:20 +0000 (05:59 +0800)
committerJeffery To <jeffery.to@gmail.com>
Sat, 12 Jan 2019 21:59:20 +0000 (05:59 +0800)
This is the patch from c98b12d9a920ede376d1eaef0da0c0da9d26d6b3 (#7931),
applied for python 2.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/python/Makefile
lang/python/python/patches/017_lib2to3_fix_pyc_search.patch [new file with mode: 0644]

index d27882883d289f62138430d7e4459d3a72b7f30b..a065edaa0d322b117b624687d4d68af1737934cf 100644 (file)
@@ -12,7 +12,7 @@ include ../python-version.mk
 
 PKG_NAME:=python
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 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/017_lib2to3_fix_pyc_search.patch b/lang/python/python/patches/017_lib2to3_fix_pyc_search.patch
new file mode 100644 (file)
index 0000000..5972914
--- /dev/null
@@ -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