Github messages for voidlinux
 help / color / mirror / Atom feed
From: ahesford <ahesford@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] [NOMERGE] Abandon pip in python3-pep517 build style
Date: Tue, 08 Nov 2022 18:46:29 +0100	[thread overview]
Message-ID: <20221108174629.2BwyJYvNLUUq2l4gS0OE094kx2qdnD0IMrEbs_HyeP0@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-40385@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]

There is an updated pull request by ahesford against master on the void-packages repository

https://github.com/ahesford/void-packages pep517
https://github.com/void-linux/void-packages/pull/40385

[NOMERGE] Abandon pip in python3-pep517 build style
Using `pip`, the package manager, as a builder and installer in the `python3-pep517` build style was always a poor choice. Now that `python3-build` and `python3-installer` have apparently matured a bit and fall under the PyPA umbrella, let's use those instead.

This poses a bit of a bootstrap problem because PyPA doesn't seem to worry about dependency cycles, so we need to handle the core packages apart from the `python3-pep517` build style. Thus, we still use `pip` to install `python3-installer` and `python3-flit_core`.

Note that these packages are still in flux. For example, `pyproject-hooks` used to be called `pep517` and is still named that in the released version, but I'm using the new name to avoid a package rename in the future. Also, `python3-build` appears to have moved to `python3-flit_core` as the build backend, but the released version is still using `python3-setuptools`. We'll get there eventually...

I'm going to rebuild all of the `python3-pep517` packages to make sure this doesn't break anything.

A patch file from https://github.com/void-linux/void-packages/pull/40385.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pep517-40385.patch --]
[-- Type: text/x-diff, Size: 10868 bytes --]

From f865e613e47bd99b6cebb1ca80b4a2090190d4a3 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Nov 2022 10:18:53 -0500
Subject: [PATCH 1/6] python3-flit_core: update to 3.8.0.

---
 srcpkgs/python3-flit_core/template | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/python3-flit_core/template b/srcpkgs/python3-flit_core/template
index 73e8809560e8..e5342b7e1a9f 100644
--- a/srcpkgs/python3-flit_core/template
+++ b/srcpkgs/python3-flit_core/template
@@ -1,10 +1,13 @@
 # Template file for 'python3-flit_core'
 pkgname=python3-flit_core
-version=3.7.1
-revision=2
+version=3.8.0
+revision=1
 build_wrksrc="flit_core"
-build_style=python3-pep517
-depends="python3-tomli"
+# This package is required by python3-build and python3-installer, used by the
+# python3-pep517 style; so using that style here would create a cycle
+build_style=python3-module
+hostmakedepends="python3-pip"
+depends="python3"
 checkdepends="python3-pytest python3-testpath $depends"
 short_desc="Simplified packaging of Python modules - PEP 517 build backend"
 maintainer="Andrew J. Hesford <ajh@sideband.org>"
@@ -12,8 +15,16 @@ license="BSD-3-Clause"
 homepage="https://flit.readthedocs.io"
 changelog="https://flit.readthedocs.io/en/latest/history.html"
 distfiles="${PYPI_SITE}/f/flit/flit-${version}.tar.gz"
-checksum=3c9bd9c140515bfe62dd938c6610d10d6efb9e35cc647fc614fe5fb3a5036682
+checksum=d0f2a8f4bd45dc794befbf5839ecc0fd3830d65a57bd52b5997542fac5d5e937
 
-post_install() {
+do_build() {
+	python3 -m flit_core.wheel
+}
+
+do_install() {
+	mkdir -p build
+	TMPDIR="${PWD}/build" python3 -m pip install --use-pep517 --prefix /usr \
+		--root "${DESTDIR}" --no-deps --no-build-isolation --no-clean \
+		"dist/flit_core-${version}-py3-none-any.whl"
 	vlicense ../LICENSE
 }

From 5a1f53a359b148af28fa9274d8a4e42ced7dcf51 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Nov 2022 11:00:25 -0500
Subject: [PATCH 2/6] New package: python3-installer-0.5.1

---
 srcpkgs/python3-installer/template | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 srcpkgs/python3-installer/template

diff --git a/srcpkgs/python3-installer/template b/srcpkgs/python3-installer/template
new file mode 100644
index 000000000000..2fc406f6fa7d
--- /dev/null
+++ b/srcpkgs/python3-installer/template
@@ -0,0 +1,30 @@
+# Template file for 'python3-installer'
+pkgname=python3-installer
+version=0.5.1
+revision=1
+# This package is used by the python3-pep517 build style; using that style here
+# would create a build cycle
+build_style=python3-module
+hostmakedepends="python3-flit_core"
+depends="python3"
+checkdepends="python3-pytest-xdist"
+short_desc="Low-level library for installing from a Python wheel"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="MIT"
+homepage="https://installer.readthedocs.io/"
+distfiles="${PYPI_SITE}/i/installer/installer-${version}.tar.gz"
+checksum=f970995ec2bb815e2fdaf7977b26b2091e1e386f0f42eafd5ac811953dc5d445
+
+do_build() {
+	python3 -m flit_core.wheel
+}
+
+do_check() {
+	PYTHONPATH=src python3 -m pytest -n $XBPS_MAKEJOBS
+}
+
+do_install() {
+	(cd src && python3 -m installer --destdir "${DESTDIR}" \
+			"../dist/installer-${version}-py3-none-any.whl" )
+	vlicense LICENSE
+}

From 847fdc5afb1b6f5658863f2dcb4cc4a24e3515e8 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Nov 2022 10:33:01 -0500
Subject: [PATCH 3/6] New package: python3-pyproject-hooks-0.13.0

---
 srcpkgs/python3-pyproject-hooks/template | 32 ++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 srcpkgs/python3-pyproject-hooks/template

diff --git a/srcpkgs/python3-pyproject-hooks/template b/srcpkgs/python3-pyproject-hooks/template
new file mode 100644
index 000000000000..d29ed4dfdf2a
--- /dev/null
+++ b/srcpkgs/python3-pyproject-hooks/template
@@ -0,0 +1,32 @@
+# Template file for 'python3-pyproject-hooks'
+pkgname=python3-pyproject-hooks
+version=0.13.0
+revision=1
+# This package is required by python3-build, used by the python3-pep517 style;
+# using that style here would create a cycle
+build_style=python3-module
+hostmakedepends="python3-flit_core python3-installer"
+depends="python3"
+checkdepends="python3-pytest-xdist python3-testpath
+ python3-setuptools python3-flit_core python3-pip"
+short_desc="Low-level library for calling Python build backends"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="MIT"
+homepage="https://pyproject-hooks.readthedocs.io/"
+distfiles="${PYPI_SITE}/p/pep517/pep517-${version}.tar.gz"
+checksum=ae69927c5c172be1add9203726d4b84cf3ebad1edcd5f71fcdc746e66e829f59
+
+do_build() {
+	python3 -m flit_core.wheel
+}
+
+do_check() {
+	rm pytest.ini
+	python3 -m pytest -n $XBPS_MAKEJOBS
+}
+
+do_install() {
+	python3 -m installer --destdir "${DESTDIR}" \
+		"dist/pep517-${version}-py3-none-any.whl"
+	vlicense LICENSE
+}

From 86b5421a235fc8b26417d134d0ab7ef84f45f9e2 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Nov 2022 10:54:30 -0500
Subject: [PATCH 4/6] New package: python3-build-0.9.0

---
 srcpkgs/python3-build/template | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 srcpkgs/python3-build/template

diff --git a/srcpkgs/python3-build/template b/srcpkgs/python3-build/template
new file mode 100644
index 000000000000..4501669ba063
--- /dev/null
+++ b/srcpkgs/python3-build/template
@@ -0,0 +1,29 @@
+# Template file for 'python3-build'
+pkgname=python3-build
+version=0.9.0
+revision=1
+# This package is used by the python3-pep517 build style; using that style here
+# would create a build cycle
+build_style=python3-module
+_depends="python3-packaging python3-pyproject-hooks"
+hostmakedepends="python3-setuptools python3-wheel python3-installer $_depends"
+depends="$_depends"
+short_desc="Simple, correct PEP 517 build frontend"
+maintainer="Andrew J. Hesford <ajh@sideband.org>"
+license="MIT"
+homepage="https://pypa-build.readthedocs.io/"
+changelog="https://raw.githubusercontent.com/pypa/build/main/CHANGELOG.rst"
+distfiles="${PYPI_SITE}/b/build/build-${version}.tar.gz"
+checksum=1a07724e891cbd898923145eb7752ee7653674c511378eb9c7691aab1612bc3c
+# PyPI package provides no tests
+make_check=no
+
+do_build() {
+	(cd src && python3 -m build --no-isolation --wheel ..)
+}
+
+do_install() {
+	python3 -m installer --destdir "${DESTDIR}" \
+		"dist/build-${version}-py3-none-any.whl"
+	vlicense LICENSE
+}

From 729bacdfe7285c4a57e199cd5893dd5f51820a00 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Nov 2022 11:48:04 -0500
Subject: [PATCH 5/6] build-style/python3-pep517.sh: abandon pip

---
 common/build-style/python3-pep517.sh           | 18 +++++-------------
 .../environment/build-style/python3-pep517.sh  |  3 ++-
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/common/build-style/python3-pep517.sh b/common/build-style/python3-pep517.sh
index da1e238e1192..6eb36924f813 100644
--- a/common/build-style/python3-pep517.sh
+++ b/common/build-style/python3-pep517.sh
@@ -3,13 +3,9 @@
 #
 
 do_build() {
-	# No PEP517 build tool currently supports compiled extensions
-	# Thus, there is no need to accommodate cross compilation here
 	: ${make_build_target:=.}
-
-	mkdir -p build
-	TMPDIR="${PWD}/build" python3 -m pip wheel --no-deps --use-pep517 --no-clean \
-		--no-build-isolation ${make_build_args} ${make_build_target}
+	: ${make_build_args:=--no-isolation  --wheel}
+	python3 -m build ${make_build_args} ${make_build_target}
 }
 
 do_check() {
@@ -26,16 +22,12 @@ do_check() {
 }
 
 do_install() {
-	# As with do_build, no need to accommodate cross compilation here
 	if [ -z "${make_install_target}" ]; then
 		# Default wheel name normalizes hyphens to underscores
 		local wheelbase="${pkgname#python3-}"
-		make_install_target="${wheelbase//-/_}-${version}-*-*-*.whl"
+		make_install_target="dist/${wheelbase//-/_}-${version}-*-*-*.whl"
 	fi
 
-	# If do_build was overridden, make sure the TMPDIR exists
-	mkdir -p build
-	TMPDIR="${PWD}/build" python3 -m pip install --use-pep517 --prefix /usr \
-		--root ${DESTDIR} --no-deps --no-build-isolation \
-		--no-clean ${make_install_args} ${make_install_target}
+	python3 -m installer --destdir ${DESTDIR} \
+		${make_install_args} ${make_install_target}
 }
diff --git a/common/environment/build-style/python3-pep517.sh b/common/environment/build-style/python3-pep517.sh
index 48f0c1b17f47..f4faf980f508 100644
--- a/common/environment/build-style/python3-pep517.sh
+++ b/common/environment/build-style/python3-pep517.sh
@@ -1,2 +1,3 @@
-hostmakedepends+=" python3-pip"
+hostmakedepends+=" python3-build python3-installer"
 lib32disabled=yes
+build_helper+=" python3"

From 4b5089c2c746105c7f9d1753b5b11b11bfa3ef58 Mon Sep 17 00:00:00 2001
From: "Andrew J. Hesford" <ajh@sideband.org>
Date: Tue, 8 Nov 2022 10:21:01 -0500
Subject: [PATCH 6/6] python3-tomli: build with packaged python3-flit_core

---
 srcpkgs/python3-tomli/template | 24 ++++--------------------
 1 file changed, 4 insertions(+), 20 deletions(-)

diff --git a/srcpkgs/python3-tomli/template b/srcpkgs/python3-tomli/template
index 8e95733a2f9d..ec26197b0a62 100644
--- a/srcpkgs/python3-tomli/template
+++ b/srcpkgs/python3-tomli/template
@@ -1,35 +1,19 @@
 # Template file for 'python3-tomli'
 pkgname=python3-tomli
 version=2.0.1
-revision=2
-create_wrksrc=yes
-build_wrksrc="tomli-${version}"
+revision=3
 build_style=python3-pep517
-hostmakedepends="python3"
+hostmakedepends="python3-flit_core"
 depends="python3"
 short_desc="Little TOML parser for Python"
 maintainer="Andrew J. Hesford <ajh@sideband.org>"
 license="MIT"
 homepage="https://github.com/hukkin/tomli"
-# flit_core>=3.4.0 requires tomli to run, while tomli requires flit_core to
-# build. Both upstreams are aware of the cycle, but neither cares:
-#     https://github.com/hukkin/tomli/issues/130
-#     https://github.com/takluyver/flit/issues/451
-# As a result, we can't use python3-flit_core to build this package, so we have
-# to just fetch the flit_core tarball to bootstrap tomli. Sigh.
-_flit_version=3.6.0
-distfiles="${PYPI_SITE}/t/tomli/tomli-${version}.tar.gz
- ${PYPI_SITE}/f/flit_core/flit_core-${_flit_version}.tar.gz"
-checksum="de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f
- 5892962ab8b8ea945835b3a288fe9dd69316f1903d5288c3f5cafdcdd04756ad"
+distfiles="${PYPI_SITE}/t/tomli/tomli-${version}.tar.gz"
+checksum="de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
 # Archive includes no tests
 make_check=no
 
-pre_build() {
-	# Build requires that tomli be able to import flit_core *and* itself!
-	export PYTHONPATH="${PWD}:${wrksrc}/flit_core-${_flit_version}"
-}
-
 post_install() {
 	vlicense LICENSE
 }

  reply	other threads:[~2022-11-08 17:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 17:38 [PR PATCH] " ahesford
2022-11-08 17:46 ` ahesford [this message]
2022-11-08 19:18 ` eli-schwartz
2022-11-08 19:37 ` ahesford
2022-11-08 19:57 ` eli-schwartz
2022-11-08 20:22 ` ahesford
2022-11-08 21:13 ` [PR PATCH] [Updated] " ahesford
2022-11-08 21:14 ` ahesford
2022-11-08 21:51 ` eli-schwartz
2022-11-08 23:06 ` [PR PATCH] [Updated] " ahesford
2022-11-08 23:08 ` ahesford
2022-11-08 23:09 ` ahesford
2022-11-08 23:44 ` [PR REVIEW] " eli-schwartz
2022-11-08 23:44 ` eli-schwartz
2022-11-08 23:52 ` eli-schwartz
2022-11-09  2:31 ` [PR PATCH] [Updated] " ahesford
2022-11-09  2:34 ` [PR REVIEW] " ahesford
2022-11-09  3:15 ` [PR PATCH] [Updated] " ahesford
2022-11-09  4:15 ` [PR REVIEW] " eli-schwartz
2022-11-10  2:24 ` [PR PATCH] [Merged]: " ahesford
2022-11-10 21:50 ` eli-schwartz

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=20221108174629.2BwyJYvNLUUq2l4gS0OE094kx2qdnD0IMrEbs_HyeP0@z \
    --to=ahesford@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).