diff options
| author | Michał Górny <mgorny@gentoo.org> | 2023-06-12 21:26:19 +0200 |
|---|---|---|
| committer | Michał Górny <mgorny@gentoo.org> | 2023-06-15 14:19:23 +0200 |
| commit | ff4c2bbf52663cc7a233e2dbccdd33b193821168 (patch) | |
| tree | 3f91e0a1a00861b9a0193670d30358a3f9ba001b /eclass/pypi.eclass | |
| parent | d72660faea4dcba0d261fbc80d9c6d62066842bd (diff) | |
| download | gentoo-ff4c2bbf52663cc7a233e2dbccdd33b193821168.tar.gz gentoo-ff4c2bbf52663cc7a233e2dbccdd33b193821168.tar.bz2 gentoo-ff4c2bbf52663cc7a233e2dbccdd33b193821168.zip | |
pypi.eclass: Translate version once in the default scenario
Instead of translating version two times, once in pypi_sdist_url
and then when setting S, do it once and store the result. This gives
roughly 371 ops / s, i.e. a 13% speedup.
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/pypi.eclass')
| -rw-r--r-- | eclass/pypi.eclass | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass index 732b0c6184ef..a8a179d5a3a4 100644 --- a/eclass/pypi.eclass +++ b/eclass/pypi.eclass @@ -226,12 +226,14 @@ pypi_wheel_url() { # @DESCRIPTION: # Set global variables, SRC_URI and S. _pypi_set_globals() { + local version=$(pypi_translate_version "${PV}") + if [[ ${PYPI_NO_NORMALIZE} ]]; then - SRC_URI="$(pypi_sdist_url --no-normalize)" - S="${WORKDIR}/${PYPI_PN}-$(pypi_translate_version "${PV}")" + SRC_URI="$(pypi_sdist_url --no-normalize "${PYPI_PN}" "${version}")" + S="${WORKDIR}/${PYPI_PN}-${version}" else - SRC_URI="$(pypi_sdist_url)" - S="${WORKDIR}/$(pypi_normalize_name "${PYPI_PN}")-$(pypi_translate_version "${PV}")" + SRC_URI="$(pypi_sdist_url "${PYPI_PN}" "${version}")" + S="${WORKDIR}/$(pypi_normalize_name "${PYPI_PN}")-${version}" fi } |
