public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/4] python-any-r1.eclass: Fix unsupported/invalid EPYTHON logic
@ 2022-02-22 23:30 Michał Górny
  2022-02-22 23:30 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Update the desc for PEP517 mode Michał Górny
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michał Górny @ 2022-02-22 23:30 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Fix the unsupported/invalid EPYTHON logic to make more sense.
As a result of prior refactoring, the eclass would report all invalid
EPYTHON values as unsupported and the invalid branch would never
be reached -- except for the special case of python2_7 where it would
incorrectly reject it.  Fix it, so that unsupported EPYTHON values
are reported either as "just unsupported" or incorrect values correctly.

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

diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index 4e954f57cd2d..805981bb7aa8 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -302,9 +302,11 @@ python_setup() {
 	local epython_impl=${EPYTHON/./_}
 	if [[ ${epython_impl} ]]; then
 		if ! has "${epython_impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
-			einfo "EPYTHON (${EPYTHON}) not supported by the package"
-		elif ! has "${epython_impl}" "${_PYTHON_ALL_IMPLS[@]}"; then
-			ewarn "Invalid EPYTHON: ${EPYTHON}"
+			if ! has "${epython_impl}" "${_PYTHON_ALL_IMPLS[@]}"; then
+				ewarn "Invalid EPYTHON: ${EPYTHON}"
+			else
+				einfo "EPYTHON (${EPYTHON}) not supported by the package"
+			fi
 		elif _python_run_check_deps "${epython_impl}"; then
 			_python_export EPYTHON PYTHON
 			_python_wrapper_setup
-- 
2.35.1



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

* [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Update the desc for PEP517 mode
  2022-02-22 23:30 [gentoo-dev] [PATCH 1/4] python-any-r1.eclass: Fix unsupported/invalid EPYTHON logic Michał Górny
@ 2022-02-22 23:30 ` Michał Górny
  2022-02-22 23:30 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Make build-backend getting more reliable Michał Górny
  2022-02-22 23:30 ` [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Do not filter error output from backend getter Michał Górny
  2 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2022-02-22 23:30 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Do not call PEP517 mode "experimental" anymore, and instead describe
the potential problem with it.

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

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index f0059d2756bf..28e44cd790ef 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -82,11 +82,15 @@ esac
 # @PRE_INHERIT
 # @DEFAULT_UNSET
 # @DESCRIPTION:
-# Enable experimental PEP 517 mode for the specified build system.
-# In this mode, the complete build and install is done
-# in python_compile(), venv-style install tree is provided
-# to python_test() and python_install() just merges the temporary
-# install tree into real fs.
+# Enable the PEP 517 mode for the specified build system.  In this mode,
+# the complete build and install is done in python_compile(), venv-style
+# install tree is provided to python_test() and python_install() just
+# merges the temporary install tree into real fs.
+#
+# This mode is recommended for Python packages.  However, some packages
+# using custom hacks on top of distutils/setuptools may not install
+# correctly in this mode.  Please verify the installed file list
+# when using it.
 #
 # The variable specifies the build system used.  Currently,
 # the following values are supported:
-- 
2.35.1



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

* [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Make build-backend getting more reliable
  2022-02-22 23:30 [gentoo-dev] [PATCH 1/4] python-any-r1.eclass: Fix unsupported/invalid EPYTHON logic Michał Górny
  2022-02-22 23:30 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Update the desc for PEP517 mode Michał Górny
@ 2022-02-22 23:30 ` Michał Górny
  2022-02-22 23:30 ` [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Do not filter error output from backend getter Michał Górny
  2 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2022-02-22 23:30 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Protect build-backend getter against stray output to stdout.

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

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 28e44cd790ef..1fe69f1a3dde 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -938,10 +938,12 @@ _distutils-r1_get_backend() {
 		# if pyproject.toml exists, try getting the backend from it
 		# NB: this could fail if pyproject.toml doesn't list one
 		build_backend=$(
-			"${EPYTHON}" - <<-EOF 2>/dev/null
+			"${EPYTHON}" - 3>&1 &>/dev/null <<-EOF
+				import os
 				import tomli
 				print(tomli.load(open("pyproject.toml", "rb"))
-					["build-system"]["build-backend"])
+						["build-system"]["build-backend"],
+					file=os.fdopen(3, "w"))
 			EOF
 		)
 	fi
-- 
2.35.1



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

* [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Do not filter error output from backend getter
  2022-02-22 23:30 [gentoo-dev] [PATCH 1/4] python-any-r1.eclass: Fix unsupported/invalid EPYTHON logic Michał Górny
  2022-02-22 23:30 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Update the desc for PEP517 mode Michał Górny
  2022-02-22 23:30 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Make build-backend getting more reliable Michał Górny
@ 2022-02-22 23:30 ` Michał Górny
  2 siblings, 0 replies; 4+ messages in thread
From: Michał Górny @ 2022-02-22 23:30 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

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

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index 1fe69f1a3dde..731b4028ae59 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -938,11 +938,12 @@ _distutils-r1_get_backend() {
 		# if pyproject.toml exists, try getting the backend from it
 		# NB: this could fail if pyproject.toml doesn't list one
 		build_backend=$(
-			"${EPYTHON}" - 3>&1 &>/dev/null <<-EOF
+			"${EPYTHON}" - 3>&1 <<-EOF
 				import os
 				import tomli
 				print(tomli.load(open("pyproject.toml", "rb"))
-						["build-system"]["build-backend"],
+						.get("build-system", {})
+						.get("build-backend", ""),
 					file=os.fdopen(3, "w"))
 			EOF
 		)
-- 
2.35.1



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

end of thread, other threads:[~2022-02-22 23:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-22 23:30 [gentoo-dev] [PATCH 1/4] python-any-r1.eclass: Fix unsupported/invalid EPYTHON logic Michał Górny
2022-02-22 23:30 ` [gentoo-dev] [PATCH 2/4] distutils-r1.eclass: Update the desc for PEP517 mode Michał Górny
2022-02-22 23:30 ` [gentoo-dev] [PATCH 3/4] distutils-r1.eclass: Make build-backend getting more reliable Michał Górny
2022-02-22 23:30 ` [gentoo-dev] [PATCH 4/4] distutils-r1.eclass: Do not filter error output from backend getter 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