When a Python package is installed from source (i.e. using setup.py)
into a custom location (with --home), setuptools may want to create a
site.py file in the custom location. This file is created based on the
source code of site-patch.py, a file bundled with setuptools.
Because the normal OpenWrt setuptools package does not contain Python
source code, this file is missing and the installation will end with an
error.
This copies site-patch.py to site-patch.py.txt so that it will be
included in python3-setuptools, and patches setuptools to look for this
file.
See https://github.com/openwrt/packages/issues/12223
Signed-off-by: Jeffery To <jeffery.to@gmail.com>
PYTHON_VERSION:=2.7
PYTHON_VERSION_MICRO:=18
-PYTHON_SETUPTOOLS_PKG_RELEASE:=1
+PYTHON_SETUPTOOLS_PKG_RELEASE:=2
PYTHON_PIP_PKG_RELEASE:=2
PYTHON_SETUPTOOLS_VERSION:=41.2.0
$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON_VERSION)/site-packages/setuptools-$(PYTHON_SETUPTOOLS_VERSION).dist-info \
$(PKG_BUILD_DIR)/install-setuptools/usr/lib/python$(PYTHON_VERSION)/site-packages/easy_install.py \
$(1)/usr/lib/python$(PYTHON_VERSION)/site-packages
+ $(CP) \
+ $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages/setuptools/site-patch.py \
+ $(1)/usr/lib/python$(PYTHON_VERSION)/site-packages/setuptools/site-patch.py.txt
endef
$(eval $(call PyBasePackage,python-setuptools, \
--- /dev/null
+--- a/setuptools/command/easy_install.py
++++ b/setuptools/command/easy_install.py
+@@ -1315,7 +1315,10 @@ class easy_install(Command):
+ return # already did it, or don't need to
+
+ sitepy = os.path.join(self.install_dir, "site.py")
+- source = resource_string("setuptools", "site-patch.py")
++ try:
++ source = resource_string("setuptools", "site-patch.py")
++ except IOError:
++ source = resource_string("setuptools", "site-patch.py.txt")
+ source = source.decode('utf-8')
+ current = ""
+