From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: James Hilliard <james.hilliard1@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
Asaf Kahlon <asafka7@gmail.com>,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v3 1/2] package/pkg-python: add setuptools-rust infrastructure
Date: Sun, 1 May 2022 22:13:44 +0200 [thread overview]
Message-ID: <20220501201344.GS3624965@scaer> (raw)
In-Reply-To: <20220501074401.1135229-1-james.hilliard1@gmail.com>
James, All,
On 2022-05-01 01:44 -0600, James Hilliard spake thusly:
> The setuptools-rust package infrastructure is essentially a variant
> of the setuptools package infrastructure which sets up the env
> and download hooks required for building setuptools-rust packages.
>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
First, thanks a lot for working on this topic; this is greatly
appreciated.
However, I believe this one is going a bit too far, at least for now.
Indeed, in Buildroot, we try to wait for until we have a few examples
of a specific package type before we add infrastructure support for it.
Usually, that rounds at about 5-ish packages.
For now, we have a single python package that is partly written in rust,
and it is not very complex, so we can live with it for now, and it
serves as a pretty good example of what is needed.
However, what I am afraid of, is that even non-python packages may end
having parts of them written in rust, and so maybe we would need a more
generic solution, with something that's be used like $(kernel-module)
or just with variables...
Until we have more such examples, then it is hard to be sure that a new
type of python packages is ther good approach or not.
Regards,
Yann E. MORIN.
> ---
> package/pkg-python.mk | 46 ++++++++++++++++++++++++++++++++++++++++---
> 1 file changed, 43 insertions(+), 3 deletions(-)
>
> diff --git a/package/pkg-python.mk b/package/pkg-python.mk
> index b86e12423f..a9bb12550c 100644
> --- a/package/pkg-python.mk
> +++ b/package/pkg-python.mk
> @@ -110,6 +110,24 @@ HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
> --root=/ \
> --single-version-externally-managed
>
> +# Target setuptools-rust-based packages
> +PKG_PYTHON_SETUPTOOLS_RUST_ENV = \
> + $(PKG_PYTHON_SETUPTOOLS_ENV) \
> + $(PKG_CARGO_ENV) \
> + PYO3_CROSS_LIB_DIR="$(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)"
> +
> +PKG_PYTHON_SETUPTOOLS_RUST_DL_ENV = \
> + $(PKG_CARGO_ENV)
> +
> +# Host setuptools-rust-based packages
> +HOST_PKG_PYTHON_SETUPTOOLS_RUST_ENV = \
> + $(HOST_PKG_PYTHON_SETUPTOOLS_ENV) \
> + $(HOST_PKG_CARGO_ENV) \
> + PYO3_CROSS_LIB_DIR="$(HOST_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)"
> +
> +HOST_PKG_PYTHON_SETUPTOOLS_RUST_DL_ENV = \
> + $(HOST_PKG_CARGO_ENV)
> +
> # Target pep517-based packages
> PKG_PYTHON_PEP517_ENV = \
> $(PKG_PYTHON_ENV)
> @@ -177,14 +195,30 @@ $(2)_BASE_BUILD_CMD = setup.py build
> $(2)_BASE_INSTALL_CMD = setup.py install $$(HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS)
> endif
> # Setuptools
> -else ifeq ($$($(2)_SETUP_TYPE),setuptools)
> +else ifneq ($$(filter setuptools setuptools-rust,$$($(2)_SETUP_TYPE)),)
> ifeq ($(4),target)
> +ifeq ($$($(2)_SETUP_TYPE),setuptools-rust)
> +$(2)_BASE_ENV = $$(PKG_PYTHON_SETUPTOOLS_RUST_ENV)
> +$(2)_DL_ENV = $$(PKG_PYTHON_SETUPTOOLS_RUST_DL_ENV)
> +$(2)_DL_ENV += BR_CARGO_MANIFEST_PATH=$$($(2)_CARGO_MANIFEST_PATH)
> +else
> $(2)_BASE_ENV = $$(PKG_PYTHON_SETUPTOOLS_ENV)
> +endif
> $(2)_BASE_BUILD_CMD = setup.py build
> $(2)_BASE_INSTALL_TARGET_CMD = setup.py install --no-compile $$(PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS)
> $(2)_BASE_INSTALL_STAGING_CMD = setup.py install $$(PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS)
> else
> +ifeq ($$($(2)_SETUP_TYPE),setuptools-rust)
> +$(2)_BASE_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_RUST_ENV)
> +$(2)_DL_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_RUST_DL_ENV)
> +ifndef $(2)_CARGO_MANIFEST_PATH
> +$(2)_DL_ENV += BR_CARGO_MANIFEST_PATH=$$($(3)_CARGO_MANIFEST_PATH)
> +else
> +$(2)_DL_ENV += BR_CARGO_MANIFEST_PATH=$$($(2)_CARGO_MANIFEST_PATH)
> +endif
> +else
> $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV)
> +endif
> $(2)_BASE_BUILD_CMD = setup.py build
> $(2)_BASE_INSTALL_CMD = setup.py install $$(HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS)
> endif
> @@ -208,7 +242,7 @@ $(2)_BASE_BUILD_CMD = -m flit_core.wheel
> $(2)_BASE_INSTALL_CMD ?= -m installer dist/*
> endif
> else
> -$$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils', 'setuptools', 'pep517' or 'flit'.")
> +$$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils', 'setuptools', 'setuptools-rust', 'pep517' or 'flit'.")
> endif
>
> # Target packages need both the python interpreter on the target (for
> @@ -225,8 +259,14 @@ endif # ($(4),target)
> # Setuptools based packages will need setuptools for the host Python
> # interpreter (both host and target).
> #
> -ifeq ($$($(2)_SETUP_TYPE),setuptools)
> +ifneq ($$(filter setuptools setuptools-rust,$$($(2)_SETUP_TYPE)),)
> $(2)_DEPENDENCIES += $$(if $$(filter host-python-setuptools,$(1)),,host-python-setuptools)
> +ifeq ($$($(2)_SETUP_TYPE),setuptools-rust)
> +$(2)_DEPENDENCIES += host-python-setuptools-rust host-rustc
> +# We need to vendor the Cargo crates at download time
> +$(2)_DOWNLOAD_POST_PROCESS = cargo
> +$(2)_DOWNLOAD_DEPENDENCIES = host-rustc
> +endif
> else ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
> $(2)_DEPENDENCIES += host-python-pypa-build host-python-installer
> ifeq ($$($(2)_SETUP_TYPE),flit)
> --
> 2.25.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-05-01 20:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-01 7:44 [Buildroot] [PATCH v3 1/2] package/pkg-python: add setuptools-rust infrastructure James Hilliard
2022-05-01 7:44 ` [Buildroot] [PATCH v3 2/2] package/python-cryptography: migrate to " James Hilliard
2022-05-01 20:13 ` Yann E. MORIN [this message]
2022-05-01 21:29 ` [Buildroot] [PATCH v3 1/2] package/pkg-python: add " James Hilliard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220501201344.GS3624965@scaer \
--to=yann.morin.1998@free.fr \
--cc=asafka7@gmail.com \
--cc=buildroot@buildroot.org \
--cc=james.hilliard1@gmail.com \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.