diff options
author | Alexandru Ardelean <ardeleanalex@gmail.com> | 2023-01-30 13:45:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-30 13:45:14 +0200 |
commit | 6cf9fa943694eb31344a2b88bd8bd84d97d0432a (patch) | |
tree | 5666f20b5db6686c7dca8de54d50fa511d12f9cf | |
parent | 70a5501f55ddca99d3cf9f6190f5ae5a665749e3 (diff) | |
parent | 61f202c0170785addbbc449e4de61cc5886f0833 (diff) |
Merge pull request #20366 from commodo/python-toml-support
python-build: add support for pyproject.toml files (reboot of #17130)
-rw-r--r-- | lang/python/python3-host.mk | 9 | ||||
-rw-r--r-- | lang/python/python3-package.mk | 3 | ||||
-rw-r--r-- | lang/python/setup.py.shim | 6 |
3 files changed, 16 insertions, 2 deletions
diff --git a/lang/python/python3-host.mk b/lang/python/python3-host.mk index 9366b78d9..8a05c332c 100644 --- a/lang/python/python3-host.mk +++ b/lang/python/python3-host.mk @@ -51,6 +51,12 @@ HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION) 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 @@ -75,8 +81,9 @@ endef # $(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 diff --git a/lang/python/python3-package.mk b/lang/python/python3-package.mk index c2617f69c..a24892ac5 100644 --- a/lang/python/python3-package.mk +++ b/lang/python/python3-package.mk @@ -62,10 +62,11 @@ 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 diff --git a/lang/python/setup.py.shim b/lang/python/setup.py.shim new file mode 100644 index 000000000..b309abc02 --- /dev/null +++ b/lang/python/setup.py.shim @@ -0,0 +1,6 @@ +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']) |