public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-dev] [PATCH v2 1/7] pypi.eclass: Move setting globals to a function
Date: Wed, 14 Jun 2023 20:33:49 +0200	[thread overview]
Message-ID: <20230614183452.17770-2-mgorny@gentoo.org> (raw)
In-Reply-To: <20230614183452.17770-1-mgorny@gentoo.org>

Signed-off-by: Michał Górny <mgorny@gentoo.org>
---
 eclass/pypi.eclass | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass
index 13dd56fa4fec..732b0c6184ef 100644
--- a/eclass/pypi.eclass
+++ b/eclass/pypi.eclass
@@ -221,12 +221,20 @@ pypi_wheel_url() {
 	fi
 }
 
-if [[ ${PYPI_NO_NORMALIZE} ]]; then
-	SRC_URI="$(pypi_sdist_url --no-normalize)"
-	S="${WORKDIR}/${PYPI_PN}-$(pypi_translate_version "${PV}")"
-else
-	SRC_URI="$(pypi_sdist_url)"
-	S="${WORKDIR}/$(pypi_normalize_name "${PYPI_PN}")-$(pypi_translate_version "${PV}")"
-fi
+# @FUNCTION: _pypi_set_globals
+# @INTERNAL
+# @DESCRIPTION:
+# Set global variables, SRC_URI and S.
+_pypi_set_globals() {
+	if [[ ${PYPI_NO_NORMALIZE} ]]; then
+		SRC_URI="$(pypi_sdist_url --no-normalize)"
+		S="${WORKDIR}/${PYPI_PN}-$(pypi_translate_version "${PV}")"
+	else
+		SRC_URI="$(pypi_sdist_url)"
+		S="${WORKDIR}/$(pypi_normalize_name "${PYPI_PN}")-$(pypi_translate_version "${PV}")"
+	fi
+}
+
+_pypi_set_globals
 
 fi
-- 
2.41.0



  reply	other threads:[~2023-06-14 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-14 18:33 [gentoo-dev] [PATCH v2 0/7] pypi.eclass: optimize, v2 Michał Górny
2023-06-14 18:33 ` Michał Górny [this message]
2023-06-14 18:33 ` [gentoo-dev] [PATCH v2 2/7] eclass/tests: Add pypi-bench.sh for global scope logic Michał Górny
2023-06-14 18:33 ` [gentoo-dev] [PATCH v2 3/7] pypi.eclass: Translate version once in the default scenario Michał Górny
2023-06-14 18:33 ` [gentoo-dev] [PATCH v2 4/7] pypi.eclass: Normalize names without subshell Michał Górny
2023-06-14 18:33 ` [gentoo-dev] [PATCH v2 5/7] pypi.eclass: Translate version without subshell in common case Michał Górny
2023-06-14 18:33 ` [gentoo-dev] [PATCH v2 6/7] pypi.eclass: Replace pypi_sdist_url in global scope Michał Górny
2023-06-14 18:33 ` [gentoo-dev] [PATCH v2 7/7] pypi.eclass: Avoid subshell for extglob setting 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=20230614183452.17770-2-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