commit: c84d64b357a7f8eca3f309f8fc773e928f57cc52 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Tue Jun 13 05:55:34 2023 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Thu Jun 15 12:19:26 2023 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c84d64b3
pypi.eclass: Avoid subshell for extglob setting Suggested by Eli Schwartz. This gives roughly 5260 ops / s, over 550% speedup. The complete patch series therefore increases the speed from roughly 326 ops / s to 5260 ops / s, making the common case 16 times faster. Closes: https://bugs.gentoo.org/908411 Closes: https://github.com/gentoo/gentoo/pull/31404 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> eclass/pypi.eclass | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/eclass/pypi.eclass b/eclass/pypi.eclass index 8911628994eb..8a842c450ebc 100644 --- a/eclass/pypi.eclass +++ b/eclass/pypi.eclass @@ -71,10 +71,13 @@ _PYPI_ECLASS=1 # via _PYPI_NORMALIZED_NAME variable. _pypi_normalize_name() { local name=${1} - local shopt_save=$(shopt -p extglob) - shopt -s extglob - name=${name//+([._-])/_} - ${shopt_save} + if shopt -p -q extglob; then + name=${name//+([._-])/_} + else + shopt -s extglob + name=${name//+([._-])/_} + shopt -u extglob + fi _PYPI_NORMALIZED_NAME="${name,,}" }
