mirror of
https://git.busybox.net/buildroot.git
synced 2024-11-23 05:23:39 +08:00
package/pkg-python.mk: add poetry setup type
As we have many python packages using the poetry(poetry-core) build system we should add a setup type for it so that we don't have to manually specify the host-python-poetry-core dependency. Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
parent
f27fc081e8
commit
0205f4c2b8
@ -429,7 +429,7 @@ different way, using different infrastructures:
|
|||||||
and xref:cmake-package-reference[reference].
|
and xref:cmake-package-reference[reference].
|
||||||
|
|
||||||
* *Makefiles for Python modules*: We have a dedicated infrastructure
|
* *Makefiles for Python modules*: We have a dedicated infrastructure
|
||||||
for Python modules that use the +flit+, +hatch+, +pep517+,
|
for Python modules that use the +flit+, +hatch+, +pep517+, +poetry+
|
||||||
+setuptools+, +setuptools-rust+ or +maturin+ mechanisms. We cover
|
+setuptools+, +setuptools-rust+ or +maturin+ mechanisms. We cover
|
||||||
them through a xref:python-package-tutorial[tutorial] and a
|
them through a xref:python-package-tutorial[tutorial] and a
|
||||||
xref:python-package-reference[reference].
|
xref:python-package-reference[reference].
|
||||||
|
@ -51,8 +51,8 @@ On line 13, we declare our dependencies, so that they are built
|
|||||||
before the build process of our package starts.
|
before the build process of our package starts.
|
||||||
|
|
||||||
On line 14, we declare the specific Python build system being used. In
|
On line 14, we declare the specific Python build system being used. In
|
||||||
this case the +setuptools+ Python build system is used. The six
|
this case the +setuptools+ Python build system is used. The seven
|
||||||
supported ones are +flit+, +hatch+, +pep517+, +setuptools+,
|
supported ones are +flit+, +hatch+, +pep517+, +poetry+, +setuptools+,
|
||||||
+setuptools-rust+ and +maturin+.
|
+setuptools-rust+ and +maturin+.
|
||||||
|
|
||||||
Finally, on line 16, we invoke the +python-package+ macro that
|
Finally, on line 16, we invoke the +python-package+ macro that
|
||||||
@ -96,14 +96,14 @@ Note that:
|
|||||||
One variable specific to the Python infrastructure is mandatory:
|
One variable specific to the Python infrastructure is mandatory:
|
||||||
|
|
||||||
* +PYTHON_FOO_SETUP_TYPE+, to define which Python build system is used
|
* +PYTHON_FOO_SETUP_TYPE+, to define which Python build system is used
|
||||||
by the package. The five supported values are +flit+, +hatch+,
|
by the package. The seven supported values are +flit+, +hatch+,
|
||||||
+pep517+ and +setuptools+, +setuptools-rust+ and +maturin+. If you
|
+pep517+, +poetry+, +setuptools+, +setuptools-rust+ and +maturin+.
|
||||||
don't know which one is used in your package, look at the +setup.py+
|
If you don't know which one is used in your package, look at the
|
||||||
or +pyproject.toml+ file in your package source code, and see whether
|
+setup.py+ or +pyproject.toml+ file in your package source code,
|
||||||
it imports things from the +flit+ module or the +setuptools+
|
and see whether it imports things from the +flit+ module or the
|
||||||
module. If the package is using a +pyproject.toml+ file without any
|
+setuptools+ module. If the package is using a +pyproject.toml+
|
||||||
build-system requires and with a local in-tree backend-path one
|
file without any build-system requires and with a local in-tree
|
||||||
should use +pep517+.
|
backend-path one should use +pep517+.
|
||||||
|
|
||||||
A few additional variables, specific to the Python infrastructure, can
|
A few additional variables, specific to the Python infrastructure, can
|
||||||
optionally be defined, depending on the package's needs. Many of them
|
optionally be defined, depending on the package's needs. Many of them
|
||||||
|
@ -258,6 +258,33 @@ HOST_PKG_PYTHON_MATURIN_BUILD_CMD = \
|
|||||||
HOST_PKG_PYTHON_MATURIN_INSTALL_CMD = \
|
HOST_PKG_PYTHON_MATURIN_INSTALL_CMD = \
|
||||||
$(HOST_PKG_PYTHON_PEP517_INSTALL_CMD)
|
$(HOST_PKG_PYTHON_PEP517_INSTALL_CMD)
|
||||||
|
|
||||||
|
# Target poetry packages
|
||||||
|
PKG_PYTHON_POETRY_ENV = \
|
||||||
|
$(PKG_PYTHON_PEP517_ENV)
|
||||||
|
|
||||||
|
PKG_PYTHON_POETRY_BUILD_CMD = \
|
||||||
|
$(PKG_PYTHON_PEP517_BUILD_CMD)
|
||||||
|
|
||||||
|
PKG_PYTHON_POETRY_INSTALL_TARGET_CMD = \
|
||||||
|
$(PKG_PYTHON_PEP517_INSTALL_TARGET_CMD)
|
||||||
|
|
||||||
|
PKG_PYTHON_POETRY_INSTALL_STAGING_CMD = \
|
||||||
|
$(PKG_PYTHON_PEP517_INSTALL_STAGING_CMD)
|
||||||
|
|
||||||
|
PKG_PYTHON_POETRY_DEPENDENCIES = \
|
||||||
|
$(PKG_PYTHON_PEP517_DEPENDENCIES) \
|
||||||
|
host-python-poetry-core
|
||||||
|
|
||||||
|
# Host poetry packages
|
||||||
|
HOST_PKG_PYTHON_POETRY_ENV = \
|
||||||
|
$(HOST_PKG_PYTHON_PEP517_ENV)
|
||||||
|
|
||||||
|
HOST_PKG_PYTHON_POETRY_BUILD_CMD = \
|
||||||
|
$(HOST_PKG_PYTHON_PEP517_BUILD_CMD)
|
||||||
|
|
||||||
|
HOST_PKG_PYTHON_POETRY_INSTALL_CMD = \
|
||||||
|
$(HOST_PKG_PYTHON_PEP517_INSTALL_CMD)
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
# inner-python-package -- defines how the configuration, compilation
|
# inner-python-package -- defines how the configuration, compilation
|
||||||
# and installation of a Python package should be done, implements a
|
# and installation of a Python package should be done, implements a
|
||||||
@ -284,8 +311,8 @@ endif
|
|||||||
|
|
||||||
$(2)_SETUP_TYPE_UPPER = $$(call UPPERCASE,$$($(2)_SETUP_TYPE))
|
$(2)_SETUP_TYPE_UPPER = $$(call UPPERCASE,$$($(2)_SETUP_TYPE))
|
||||||
|
|
||||||
ifneq ($$(filter-out setuptools setuptools-rust pep517 flit flit-bootstrap hatch maturin,$$($(2)_SETUP_TYPE)),)
|
ifneq ($$(filter-out setuptools setuptools-rust pep517 flit flit-bootstrap hatch maturin poetry,$$($(2)_SETUP_TYPE)),)
|
||||||
$$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'maturin', 'setuptools', 'setuptools-rust', 'pep517', 'flit' or 'hatch'.")
|
$$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'maturin', 'setuptools', 'setuptools-rust', 'pep517', 'flit', 'hatch' or 'poetry'.")
|
||||||
endif
|
endif
|
||||||
ifeq ($(4)-$$($(2)_SETUP_TYPE),target-flit-bootstrap)
|
ifeq ($(4)-$$($(2)_SETUP_TYPE),target-flit-bootstrap)
|
||||||
$$(error flit-bootstrap setup type only supported for host packages)
|
$$(error flit-bootstrap setup type only supported for host packages)
|
||||||
|
@ -419,6 +419,8 @@ class BuildrootPackage():
|
|||||||
self.setup_metadata['method'] = 'flit'
|
self.setup_metadata['method'] = 'flit'
|
||||||
elif build_backend == 'hatchling.build':
|
elif build_backend == 'hatchling.build':
|
||||||
self.setup_metadata['method'] = 'hatch'
|
self.setup_metadata['method'] = 'hatch'
|
||||||
|
elif build_backend == 'poetry.core.masonry.api':
|
||||||
|
self.setup_metadata['method'] = 'poetry'
|
||||||
elif build_backend == 'setuptools.build_meta':
|
elif build_backend == 'setuptools.build_meta':
|
||||||
self.setup_metadata['method'] = 'setuptools'
|
self.setup_metadata['method'] = 'setuptools'
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user