Browse Source

Merge pull request #4475 from commodo/fix-distutils-import

python3: fix distutils path to package when using bytecodes
lilik-openwrt-22.03
Hannu Nyman 8 years ago
committed by GitHub
parent
commit
c1bf9a750d
2 changed files with 17 additions and 1 deletions
  1. +1
    -1
      lang/python/python3/Makefile
  2. +16
    -0
      lang/python/python3/patches/008-fix-distutils-path-creation.patch

+ 1
- 1
lang/python/python3/Makefile View File

@ -14,7 +14,7 @@ PYTHON_VERSION:=$(PYTHON3_VERSION)
PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO) PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
PKG_NAME:=python3 PKG_NAME:=python3
PKG_RELEASE:=2
PKG_RELEASE:=3
PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO) PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz


+ 16
- 0
lang/python/python3/patches/008-fix-distutils-path-creation.patch View File

@ -0,0 +1,16 @@
diff --git a/Lib/imp.py b/Lib/imp.py
index 781ff23..beeac70 100644
--- a/Lib/imp.py
+++ b/Lib/imp.py
@@ -203,8 +203,9 @@ def load_package(name, path):
extensions = (machinery.SOURCE_SUFFIXES[:] +
machinery.BYTECODE_SUFFIXES[:])
for extension in extensions:
- path = os.path.join(path, '__init__'+extension)
- if os.path.exists(path):
+ init_path = os.path.join(path, '__init__'+extension)
+ if os.path.exists(init_path):
+ path = init_path
break
else:
raise ValueError('{!r} is not a package'.format(path))

Loading…
Cancel
Save