diff options
| author | Alexandru Ardelean <ardeleanalex@gmail.com> | 2021-11-15 09:26:29 +0200 |
|---|---|---|
| committer | Josef Schlehofer <pepe.schlehofer@gmail.com> | 2023-10-13 08:23:08 +0200 |
| commit | dc68822dcce78482101cf45131b47a39bff1506b (patch) | |
| tree | f172241fb1764c3e16d87da6648d8976c85f2dfb /lang/python/python3-host.mk | |
| parent | 912aaaa9cfc9449feabb4239276cfd5c09628638 (diff) | |
python-build: add support for pyproject.toml files
A new PEP 517 (https://www.python.org/dev/peps/pep-0517/) has defined that
Python packages can be shipped without any `setup.py` file, and that a
`pyproject.toml` file is sufficient.
A `setup.py` shim layer is suggested as a method for running the build.
For these cases, we will add a support in the OpenWrt build-system to
provide the default `setup.py` shim layer in case this file does not exist,
but there is a `pyproject.toml` file.
We also seem to need to tweak the shim layer with the PKG_VERSION,
otherwise the detected version is 0.0.0.
We will need to see if this will be fixed later in setuptools{-scm}.
Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
(cherry picked from commit 61f202c0170785addbbc449e4de61cc5886f0833)
Diffstat (limited to 'lang/python/python3-host.mk')
| -rw-r--r-- | lang/python/python3-host.mk | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/lang/python/python3-host.mk b/lang/python/python3-host.mk index fa3d3ace3..fdf6658fd 100644 --- a/lang/python/python3-host.mk +++ b/lang/python/python3-host.mk @@ -93,6 +93,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 @@ -117,8 +123,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 |
