From 480e4d7e88b321f8b9e15901e52251a1296315dc Mon Sep 17 00:00:00 2001 From: Jeffery To Date: Sun, 13 Jan 2019 06:14:36 +0800 Subject: [PATCH] python/python3: Fix lib2to3 fixes search This is the patch from c98b12d9a920ede376d1eaef0da0c0da9d26d6b3 (#7931), applied for both python 2 and 3. Signed-off-by: Jeffery To --- lang/python/python/Makefile | 2 +- .../patches/017_lib2to3_fix_pyc_search.patch | 17 +++++++++++++++++ lang/python/python3/Makefile | 2 +- .../patches/017_lib2to3_fix_pyc_search.patch | 17 +++++++++++++++++ 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 lang/python/python/patches/017_lib2to3_fix_pyc_search.patch create mode 100644 lang/python/python3/patches/017_lib2to3_fix_pyc_search.patch diff --git a/lang/python/python/Makefile b/lang/python/python/Makefile index 769ac5b5d..b0e367748 100644 --- a/lang/python/python/Makefile +++ b/lang/python/python/Makefile @@ -12,7 +12,7 @@ include ../python-version.mk PKG_NAME:=python PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) -PKG_RELEASE:=2 +PKG_RELEASE:=3 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 index 000000000..5972914bd --- /dev/null +++ b/lang/python/python/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 + + diff --git a/lang/python/python3/Makefile b/lang/python/python3/Makefile index 7ece10330..0c5c2fca4 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:=2 +PKG_RELEASE:=3 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 + +