package/pkg-python.mk: add uv setup type
PATCH 1/2 package/pkg-python.mk: add uv setup type
Add a uv setup type for packages using the uv_build backend. Reuse the PEP 517 build and installation commands and automatically add host-python-uv-build to the package dependencies.
Document the setup type and teach scanpypi to recognize uv_build.
Signed-off-by James Hilliard <[email protected]>
--- docs/manual/adding-packages-directory.adoc | 4 +-- docs/manual/adding-packages-python.adoc | 8 +++--- package/pkg-python.mk | 31 ++++++++++++++++++++-- utils/scanpypi | 2 ++ 4 files changed, 37 insertions(+), 8 deletions(-)
docs/manual/adding-packages-directory.adoc +2 -2
@@ -429,8 +429,8 @@ different way, using different infrastructures: and xref:cmake-package-reference[reference]. * *Makefiles for Python modules*: We have a dedicated infrastructure - for Python modules that use the +flit+, +hatch+, +pep517+, +poetry+ - +setuptools+, +setuptools-rust+ or +maturin+ mechanisms. We cover + for Python modules that use the +flit+, +hatch+, +pep517+, +poetry+, + +setuptools+, +setuptools-rust+, +maturin+ or +uv+ mechanisms. We cover them through a xref:python-package-tutorial[tutorial] and a xref:python-package-reference[reference].
docs/manual/adding-packages-python.adoc +4 -4
@@ -51,9 +51,9 @@ On line 13, we declare our dependencies, so that they are built before the build process of our package starts. On line 14, we declare the specific Python build system being used. In -this case the +setuptools+ Python build system is used. The seven +this case the +setuptools+ Python build system is used. The eight supported ones are +flit+, +hatch+, +pep517+, +poetry+, +setuptools+, -+setuptools-rust+ and +maturin+. ++setuptools-rust+, +maturin+ and +uv+. Finally, on line 16, we invoke the +python-package+ macro that generates all the Makefile rules that actually allow the package to be
@@ -96,8 +96,8 @@ Note that: One variable specific to the Python infrastructure is mandatory: * +PYTHON_FOO_SETUP_TYPE+, to define which Python build system is used - by the package. The seven supported values are +flit+, +hatch+, - +pep517+, +poetry+, +setuptools+, +setuptools-rust+ and +maturin+. + by the package. The eight supported values are +flit+, +hatch+, + +pep517+, +poetry+, +setuptools+, +setuptools-rust+, +maturin+ and +uv+. If you don't know which one is used in your package, look at the +setup.py+ or +pyproject.toml+ file in your package source code, and see whether it imports things from the +flit+ module or the
package/pkg-python.mk +29 -2
@@ -285,6 +285,33 @@ HOST_PKG_PYTHON_POETRY_BUILD_CMD = \ HOST_PKG_PYTHON_POETRY_INSTALL_CMD = \ $(HOST_PKG_PYTHON_PEP517_INSTALL_CMD) +# Target uv packages +PKG_PYTHON_UV_ENV = \ + $(PKG_PYTHON_PEP517_ENV) + +PKG_PYTHON_UV_BUILD_CMD = \ + $(PKG_PYTHON_PEP517_BUILD_CMD) + +PKG_PYTHON_UV_INSTALL_TARGET_CMD = \ + $(PKG_PYTHON_PEP517_INSTALL_TARGET_CMD) + +PKG_PYTHON_UV_INSTALL_STAGING_CMD = \ + $(PKG_PYTHON_PEP517_INSTALL_STAGING_CMD) + +PKG_PYTHON_UV_DEPENDENCIES = \ + $(PKG_PYTHON_PEP517_DEPENDENCIES) \ + host-python-uv-build + +# Host uv packages +HOST_PKG_PYTHON_UV_ENV = \ + $(HOST_PKG_PYTHON_PEP517_ENV) + +HOST_PKG_PYTHON_UV_BUILD_CMD = \ + $(HOST_PKG_PYTHON_PEP517_BUILD_CMD) + +HOST_PKG_PYTHON_UV_INSTALL_CMD = \ + $(HOST_PKG_PYTHON_PEP517_INSTALL_CMD) + ################################################################################ # inner-python-package -- defines how the configuration, compilation # and installation of a Python package should be done, implements a
@@ -311,8 +338,8 @@ endif $(2)_SETUP_TYPE_UPPER = $$(call UPPERCASE,$$($(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', 'hatch' or 'poetry'.") +ifneq ($$(filter-out setuptools setuptools-rust pep517 flit flit-bootstrap hatch maturin poetry uv,$$($(2)_SETUP_TYPE)),) +$$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'maturin', 'setuptools', 'setuptools-rust', 'pep517', 'flit', 'hatch', 'poetry' or 'uv'.") endif ifeq ($(4)-$$($(2)_SETUP_TYPE),target-flit-bootstrap) $$(error flit-bootstrap setup type only supported for host packages)
utils/scanpypi +2 -0
@@ -414,6 +414,8 @@ class BuildrootPackage(): self.setup_metadata['method'] = 'poetry' elif build_backend == 'setuptools.build_meta': self.setup_metadata['method'] = 'setuptools' + elif build_backend == 'uv_build': + self.setup_metadata['method'] = 'uv' else: if self.backend_path: self.setup_metadata['method'] = 'pep517'
Signature · 6 lines
2.53.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/2 package/python-bidict: use uv setup type
Signed-off-by James Hilliard <[email protected]>
--- package/python-bidict/python-bidict.mk | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
package/python-bidict/python-bidict.mk +1 -2
@@ -7,10 +7,9 @@ PYTHON_BIDICT_VERSION = 0.24.1 PYTHON_BIDICT_SOURCE = bidict-$(PYTHON_BIDICT_VERSION).tar.gz PYTHON_BIDICT_SITE = https://files.pythonhosted.org/packages/a8/f2/8d2dd8276ca05e1f5157b6a0d34efb2f585f47a0fbed61e8aad04b221f0b -PYTHON_BIDICT_SETUP_TYPE = pep517 +PYTHON_BIDICT_SETUP_TYPE = uv PYTHON_BIDICT_LICENSE = MPL-2.0 PYTHON_BIDICT_LICENSE_FILES = LICENSE -PYTHON_BIDICT_DEPENDENCIES = host-python-uv-build PYTHON_BIDICT_BUILD_OPTS = --skip-dependency-check $(eval $(python-package))
Signature · 6 lines
2.53.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot