From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH 06/30] python-any-r1.eclass: Move EPYTHON validity check to python_setup()
Date: Sun, 6 Feb 2022 13:48:17 +0100 [thread overview]
Message-ID: <20220206124841.1299133-7-mgorny@gentoo.org> (raw)
In-Reply-To: <20220206124841.1299133-1-mgorny@gentoo.org>
Move the EPYTHON validity check from _python_EPYTHON_supported()
to python_setup() where it belongs. This avoids unnecessarily retesting
implementations taken from PYTHON_COMPAT and paves the way towards
moving the common logic to python-utils-r1.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
eclass/python-any-r1.eclass | 36 ++++++++++++++----------------------
1 file changed, 14 insertions(+), 22 deletions(-)
diff --git a/eclass/python-any-r1.eclass b/eclass/python-any-r1.eclass
index 282c449f2a03..4c832384ed7a 100644
--- a/eclass/python-any-r1.eclass
+++ b/eclass/python-any-r1.eclass
@@ -283,28 +283,15 @@ _python_EPYTHON_supported() {
local EPYTHON=${1}
local i=${EPYTHON/./_}
- case "${i}" in
- python*|jython*|pypy*)
- ;;
- *)
- ewarn "Invalid EPYTHON: ${EPYTHON}"
- return 1
- ;;
- esac
-
- if has "${i}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
- if python_is_installed "${i}"; then
- if declare -f python_check_deps >/dev/null; then
- local PYTHON_USEDEP="python_targets_${i}(-)"
- local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)"
- python_check_deps
- return ${?}
- fi
-
- return 0
+ if python_is_installed "${i}"; then
+ if declare -f python_check_deps >/dev/null; then
+ local PYTHON_USEDEP="python_targets_${i}(-)"
+ local PYTHON_SINGLE_USEDEP="python_single_target_${i}(-)"
+ python_check_deps
+ return ${?}
fi
- elif ! has "${i}" "${_PYTHON_ALL_IMPLS[@]}"; then
- ewarn "Invalid EPYTHON: ${EPYTHON}"
+
+ return 0
fi
return 1
}
@@ -338,7 +325,12 @@ python_setup() {
# first, try ${EPYTHON}... maybe it's good enough for us.
if [[ ${EPYTHON} ]]; then
- if _python_EPYTHON_supported "${EPYTHON}"; then
+ local impl=${EPYTHON/./_}
+ if ! has "${impl}" "${_PYTHON_SUPPORTED_IMPLS[@]}"; then
+ einfo "EPYTHON (${EPYTHON}) not supported by the package"
+ elif ! has "${impl}" "${_PYTHON_ALL_IMPLS[@]}"; then
+ ewarn "Invalid EPYTHON: ${EPYTHON}"
+ elif _python_EPYTHON_supported "${EPYTHON}"; then
_python_export EPYTHON PYTHON
_python_wrapper_setup
einfo "Using ${EPYTHON} to build"
--
2.35.1
next prev parent reply other threads:[~2022-02-06 12:51 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-06 12:48 [gentoo-dev] [PATCH 00/30] One batch of Python eclass updates to rule them all Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 01/30] distutils-r1.eclass: Split backend getting code into a function Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 02/30] distutils-r1.eclass: Get wheel name from the backend Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 03/30] distutils-r1.eclass: Create distutils_pep517_install helper Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 04/30] dev-python/isort: Switch to PEP 517 build Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 05/30] python-r1.eclass: Remove deprecated python_gen_usedep Michał Górny
2022-02-06 12:48 ` Michał Górny [this message]
2022-02-06 12:48 ` [gentoo-dev] [PATCH 07/30] python-utils-r1.eclass: Add function to run python_check_deps() Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 08/30] python-any-r1.eclass: Explain the reason for interpreter choice Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 09/30] python-utils-r1.eclass: Report _python_run_check_deps verbosely Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 10/30] python-utils-r1.eclass: Inline python_is_installed Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 11/30] distutils-r1.eclass: Fix has_version for distutils_enable_sphinx Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 12/30] python-utils-r1.eclass: Add a verbose python_has_version() wrapper Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 13/30] distutils-r1.eclass: Use python_has_version in ...enable_sphinx Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 14/30] python-utils-r1.eclass: Fix sphinx_build for non-autodoc case Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 15/30] python-utils-r1.eclass: Remove deprecated python_export Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 16/30] python-utils-r1.eclass: Remove python_wrapper_setup Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 17/30] python-single-r1.eclass: Inline & simplify USE-deps in gen_cond_dep Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 18/30] python-r1.eclass: Improve comment for USE-dep generation Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 19/30] python-utils-r1.eclass: Remove python_is_python3 Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 20/30] python-single-r1.eclass: Remove PYTHON_MULTI_USEDEP Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 21/30] distutils-r1.eclass: Use heredoc instead of "python -c" Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 22/30] python-utils-r1.eclass: " Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 23/30] python-utils-r1.eclass: Remove old phase check from python_optimize Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 24/30] python-utils-r1.eclass: Add status messages to python_optimize Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 25/30] python-utils-r1.eclass: Support matching impls by stdlib version Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 26/30] dev-python/jaraco-text: Use python_gen_cond_dep w/ stdlib ver Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 27/30] python-any-r1.eclass: Do not test EPYTHON twice Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 28/30] python-utils-r1.eclass: Add QA check for obsolete PYTHON_COMPAT Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 29/30] dev-libs/libwacom: Use python_has_version for verbose output Michał Górny
2022-02-08 23:00 ` Matt Turner
2022-02-08 23:18 ` Matt Turner
2022-02-08 23:54 ` Michał Górny
2022-02-06 12:48 ` [gentoo-dev] [PATCH 30/30] distutils-r1.eclass: Add min version to tomli dep Michał Górny
2022-02-09 7:34 ` [gentoo-dev] [PATCH 00/30] One batch of Python eclass updates to rule them all Sam James
2022-02-09 9:22 ` Joshua Kinard
2022-02-09 9:39 ` Michał Górny
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=20220206124841.1299133-7-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-dev@lists.gentoo.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