All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hilliard <james.hilliard1@gmail.com>
To: buildroot@buildroot.org
Cc: Bernd Kuhls <bernd.kuhls@t-online.de>,
	James Hilliard <james.hilliard1@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Asaf Kahlon <asafka7@gmail.com>
Subject: [Buildroot] [PATCH 1/2] package/pkg-python: add setup.cfg-only setuptools project support
Date: Sun,  8 May 2022 19:09:16 -0600	[thread overview]
Message-ID: <20220509010917.1485280-1-james.hilliard1@gmail.com> (raw)

Some projects have been removing their setup.py shims under the
assumption that they are not needed due to setuptools being usable
via pep517, however this is not actually the case as it is not
possible to bootstrap setuptools without setup.py style builds as
setuptools has a dependency on wheel when being used via pep517
which is itself not installable via pep517 as that would create a
dependency cycle between wheel and setuptools(which means wheel
itself must use a legacy setup.py build/installation for itself).

In addition our pep517 toolchain itself requires setuptools for
building/installing dependencies, although it would appear these
dependencies will eventually move to flit. Until this is resolved
we must use setup.py style builds for setuptools packages.

Since it is not yet possible to convert setup.py based setuptools
builds to pep517 based setuptools builds we simply need to execute
the setuptools shim code directly if the setup.py file is missing.

See:
https://setuptools.pypa.io/en/latest/setuptools.html#setup-cfg-only-projects

Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
 package/pkg-python.mk | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/package/pkg-python.mk b/package/pkg-python.mk
index 452fa0d3ea..5794e3a195 100644
--- a/package/pkg-python.mk
+++ b/package/pkg-python.mk
@@ -86,6 +86,9 @@ PKG_PYTHON_SETUPTOOLS_ENV = \
 	$(PKG_PYTHON_ENV) \
 	SETUPTOOLS_USE_DISTUTILS=stdlib
 
+PKG_PYTHON_SETUPTOOLS_CMD = \
+	$(if $(wildcard $($(PKG)_BUILDDIR)/setup.py),setup.py,-c 'from setuptools import setup;setup()')
+
 PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \
 	--install-headers=/usr/include/python$(PYTHON3_VERSION_MAJOR) \
 	--prefix=/usr \
@@ -180,13 +183,13 @@ endif
 else ifeq ($$($(2)_SETUP_TYPE),setuptools)
 ifeq ($(4),target)
 $(2)_BASE_ENV = $$(PKG_PYTHON_SETUPTOOLS_ENV)
-$(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)
+$(2)_BASE_BUILD_CMD = $$(PKG_PYTHON_SETUPTOOLS_CMD) build
+$(2)_BASE_INSTALL_TARGET_CMD = $$(PKG_PYTHON_SETUPTOOLS_CMD) install --no-compile $$(PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS)
+$(2)_BASE_INSTALL_STAGING_CMD = $$(PKG_PYTHON_SETUPTOOLS_CMD) install $$(PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS)
 else
 $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV)
-$(2)_BASE_BUILD_CMD = setup.py build
-$(2)_BASE_INSTALL_CMD = setup.py install $$(HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS)
+$(2)_BASE_BUILD_CMD = $$(PKG_PYTHON_SETUPTOOLS_CMD) build
+$(2)_BASE_INSTALL_CMD = $$(PKG_PYTHON_SETUPTOOLS_CMD) install $$(HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS)
 endif
 else ifneq ($$(filter flit pep517,$$($(2)_SETUP_TYPE)),)
 ifeq ($(4),target)
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

             reply	other threads:[~2022-05-09  1:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09  1:09 James Hilliard [this message]
2022-05-09  1:09 ` [Buildroot] [PATCH 2/2] package/python-cssutils: bump to version 2.4.0 James Hilliard
2022-05-10 12:15 ` [Buildroot] [PATCH 1/2] package/pkg-python: add setup.cfg-only setuptools project support Yegor Yefremov via buildroot
2022-05-13 22:07 ` Arnout Vandecappelle

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=20220509010917.1485280-1-james.hilliard1@gmail.com \
    --to=james.hilliard1@gmail.com \
    --cc=asafka7@gmail.com \
    --cc=bernd.kuhls@t-online.de \
    --cc=buildroot@buildroot.org \
    --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.