Skip to contentSkip to conversation

package/pkg-python: add setup.cfg-only setuptools project support

PATCH In review James Hilliard 3 participants 4 messages May 9, 2022 – May 13, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 package/pkg-python: add setup.cfg-only setuptools project support

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

---
 package/pkg-python.mk | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
package/pkg-python.mk +8 -5
index 452fa0d3ea..5794e3a195 100644
@@ -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)
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

PATCH 2/2 package/python-cssutils: bump to version 2.4.0

---
 package/python-cssutils/python-cssutils.hash | 4 ++--
 package/python-cssutils/python-cssutils.mk   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
package/python-cssutils/python-cssutils.hash +2 -2
index e22dde6e56..13459f7270 100644
@@ -1,5 +1,5 @@
 # md5, sha256 from https://pypi.org/pypi/cssutils/json
-md5  71955999f595e4b0eb5a218d614652ca  cssutils-2.3.0.tar.gz
-sha256  b2d3b16047caae82e5c590036935bafa1b621cf45c2f38885af4be4838f0fd00  cssutils-2.3.0.tar.gz
+md5  4ae0e6c670483043260363f593e96a69  cssutils-2.4.0.tar.gz
+sha256  2d97210a83b0a3fe1e4469f5ff9a6420b078572035188b1bab7103c3a36dc89b  cssutils-2.4.0.tar.gz
 # Locally computed sha256 checksums
 sha256  03c570a068086ee577dcd795519ea93462b2ed2fcb6dcc4dfce56a71a2fd6e5a  COPYING.LESSER
package/python-cssutils/python-cssutils.mk +2 -2
index 09c2ca44d6..fc65c893ac 100644
@@ -4,9 +4,9 @@
 #
 ################################################################################
 
-PYTHON_CSSUTILS_VERSION = 2.3.0
+PYTHON_CSSUTILS_VERSION = 2.4.0
 PYTHON_CSSUTILS_SOURCE = cssutils-$(PYTHON_CSSUTILS_VERSION).tar.gz
-PYTHON_CSSUTILS_SITE = https://files.pythonhosted.org/packages/f5/c6/878abb7df855938a067b762a688da3fcdfea4e41c2399feaf80369b61ed7
+PYTHON_CSSUTILS_SITE = https://files.pythonhosted.org/packages/f4/ea/d09b04b5cf6ad84f45ca4c523d3e153dd9be1f12650c825d1c92ca0618a2
 PYTHON_CSSUTILS_LICENSE = LGPL-3.0+
 PYTHON_CSSUTILS_LICENSE_FILES = COPYING.LESSER
 PYTHON_CSSUTILS_SETUP_TYPE = setuptools
Signature · 6 lines
2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Tested-by Yegor Yefremov on v1 1/2
#2 lore raw
In reply to James Hilliard

Hi James,

Quoted 15 lines · James Hilliard

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.

Quoted 8 lines

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

Regards,
Yegor

Quoted 38 lines
---
 package/pkg-python.mk | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
package/pkg-python.mk +8 -6
index 452fa0d3ea..5794e3a195 100644
@@ -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)
--
Quoted 2 lines

2.25.1

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot

#3 lore raw
In reply to James Hilliard
Quoted 8 lines · James Hilliard

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).

I found this explanation a bit confusing, but I *think* you're saying "We
can't simply always use the 'from setuptools import setup' approach".

Anyway, applied both to master, thanks.

Regards,
Arnout

Quoted 41 lines

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

---
  package/pkg-python.mk | 13 ++++++++-----
  1 file changed, 8 insertions(+), 5 deletions(-)
package/pkg-python.mk +5 -3
index 452fa0d3ea..5794e3a195 100644
@@ -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)

package/pkg-python.mk endif · line 195

Quoted 10 lines
package/pkg-python.mk +3 -2
+$(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)

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot