public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/3] distutils-r1.eclass: Fix setuptools without setup.py
@ 2021-02-06 11:54 Michał Górny
  2021-02-06 11:54 ` [gentoo-dev] [PATCH 2/3] dev-python/tikzplotlib: Use distutils-r1 pyproject.toml support Michał Górny
  2021-02-06 11:54 ` [gentoo-dev] [PATCH 3/3] distutils-r1.eclass: Require EPYTHON to be set Michał Górny
  0 siblings, 2 replies; 4+ messages in thread
From: Michał Górny @ 2021-02-06 11:54 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Invoke pyproject2setuppy directly instead of writing the setup.py
wrapper.  This is necessary to correctly support setuptools via
pyproject.toml without setup.py.  Writing setup.py confuses
pyproject2setuppy into running the setup.py code path instead of
the correct non-setup.py path.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/distutils-r1.eclass | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index d5bb0df4d927..cb64938c8c32 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -523,7 +523,13 @@ esetup.py() {
 
 	[[ ${BUILD_DIR} ]] && _distutils-r1_create_setup_cfg
 
-	set -- "${EPYTHON:-python}" setup.py "${mydistutilsargs[@]}" "${@}"
+	local setup_py=( setup.py )
+	if [[ ${DISTUTILS_USE_SETUPTOOLS} == pyproject.toml ]]; then
+		# TODO: remove '.main' when we require v10
+		setup_py=( -m pyproject2setuppy.main )
+	fi
+
+	set -- "${EPYTHON:-python}" "${setup_py[@]}" "${mydistutilsargs[@]}" "${@}"
 
 	echo "${@}" >&2
 	"${@}" || die "${die_args[@]}"
@@ -632,14 +638,7 @@ _distutils-r1_disable_ez_setup() {
 # Generate setup.py for pyproject.toml if requested.
 _distutils-r1_handle_pyproject_toml() {
 	if [[ ! -f setup.py && -f pyproject.toml ]]; then
-		if [[ ${DISTUTILS_USE_SETUPTOOLS} == pyproject.toml ]]; then
-			cat > setup.py <<-EOF || die
-				#!/usr/bin/env python
-				from pyproject2setuppy.main import main
-				main()
-			EOF
-			chmod +x setup.py || die
-		else
+		if [[ ${DISTUTILS_USE_SETUPTOOLS} != pyproject.toml ]]; then
 			eerror "No setup.py found but pyproject.toml is present.  In order to enable"
 			eerror "pyproject.toml support in distutils-r1, set:"
 			eerror "  DISTUTILS_USE_SETUPTOOLS=pyproject.toml"
-- 
2.30.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-06 13:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-06 11:54 [gentoo-dev] [PATCH 1/3] distutils-r1.eclass: Fix setuptools without setup.py Michał Górny
2021-02-06 11:54 ` [gentoo-dev] [PATCH 2/3] dev-python/tikzplotlib: Use distutils-r1 pyproject.toml support Michał Górny
2021-02-06 13:23   ` Andrew Ammerlaan
2021-02-06 11:54 ` [gentoo-dev] [PATCH 3/3] distutils-r1.eclass: Require EPYTHON to be set Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox