commit:     c7c532ccb84c6e562807b6b8335361a11412d839
Author:     Oskari Pirhonen <xxc3ncoredxx <AT> gmail <DOT> com>
AuthorDate: Sat Apr  1 04:49:31 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Apr  7 09:50:00 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c7c532cc

ci: add basic pypy support to setup-python.sh

Install pypy by specifying 'pypy3' in the PYTHON_VERSIONS.

... and fix indents and ensure system python has venv module

Signed-off-by: Oskari Pirhonen <xxc3ncoredxx <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .builds/setup-python.sh | 23 +++++++++++++++--------
 1 file changed, 15 insertions(+), 8 deletions(-)

diff --git a/.builds/setup-python.sh b/.builds/setup-python.sh
index be113ce8e..72e63ad95 100755
--- a/.builds/setup-python.sh
+++ b/.builds/setup-python.sh
@@ -4,17 +4,24 @@
 set -ex
 
 install_versions=( "${@/#/python}" )
+# Fix any pypy versions
+install_versions=( "${install_versions[@]/#pythonpypy/pypy}" )
 
 sudo apt-get install -y --no-install-recommends \
-    python-is-python3 \
-    "${install_versions[@]}" \
-    "${install_versions[@]/%/-venv}"
+        python-is-python3 \
+        python3-venv \
+        "${install_versions[@]}" \
+        "${install_versions[@]/%/-venv}"
 
-for py in "${@}"; do
-  "python$py" -m venv ".venv-$py"
-  source ".venv-$py/bin/activate"
-  pip install --upgrade pip
-  deactivate
+for py in "$@"; do
+    if [[ "$py" != pypy* ]]; then
+        "python$py" -m venv ".venv-$py"
+    else
+        "$py" -m venv ".venv-$py"
+    fi
+    source ".venv-$py/bin/activate"
+    pip install --upgrade pip
+    deactivate
 done
 
 python -m venv .venv

Reply via email to