HOST_PYTHON3_PIP_CACHE_DIR:=$(DL_DIR)/pip-cache
+define SetupPyShim
+ if [ -f $(1)/pyproject.toml ] && [ ! -f $(1)/setup.py ] ; then \
+ $(CP) $(python3_mk_path)setup.py.shim $(1)setup.py ; \
+ fi
+endef
+
# Multiple concurrent pip processes can lead to errors or unexpected results: https://github.com/pypa/pip/issues/2361
# $(1) => packages to install
define HostPython3/PipInstall
# $(2) => additional arguments to setup.py
# $(3) => additional variables
define HostPython3/ModSetup
+ $(call SetupPyShim,$(HOST_BUILD_DIR)/$(strip $(1)))
$(call HostPython3/Run, \
$(HOST_BUILD_DIR)/$(strip $(1)), \
setup.py $(2), \
- $(3))
+ $(3) PY_PKG_VERSION=$(PKG_VERSION))
endef
# $(3) => additional variables
define Python3/ModSetup
$(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
+ $(call SetupPyShim,$(PKG_BUILD_DIR)/$(strip $(1)))
$(call Python3/Run, \
$(PKG_BUILD_DIR)/$(strip $(1)), \
setup.py $(2), \
- $(3))
+ $(3) PY_PKG_VERSION=$(PKG_VERSION))
endef
define Python3/FixShebang
--- /dev/null
+import os
+import setuptools
+
+# FIXME: see about getting rid of PY_PKG_VERSION asap when setuptools handles this correctly
+if __name__ == "__main__":
+ setuptools.setup(version=os.environ['PY_PKG_VERSION'])