@@ -12,60 +12,6 @@ steps:
1212 }
1313 displayName: 'Use Public Feed'
1414
15- # Optional override for the hosted toolcache PyPy build. Activated when the
16- # matrix entry sets:
17- # OverridePyPyVersion: "true"
18- # PyPyBuildVersion: "v7.3.22" (or any release from downloads.python.org/pypy)
19- # PyPyLangVersion: "3.11.15" (the Python language version directory in the toolcache)
20- # Rationale: PyPy 7.3.21 (currently in the hosted toolcache for Python 3.11.15)
21- # crashes with `Fatal RPython error: AssertionError` from
22- # `PythonCodeMaker_duplicate_exits_without_lineno` while compiling
23- # `azure.ai.ml`. PyPy 7.3.22+ does not exhibit this bug.
24- - bash : |
25- set -euo pipefail
26- PYPY_BUILD="${PYPY_BUILD_VERSION:?PyPyBuildVersion must be set in the matrix when OverridePyPyVersion=true}"
27- PY_LANG="${PYPY_LANG_VERSION:?PyPyLangVersion must be set in the matrix when OverridePyPyVersion=true}"
28- TARGET="/opt/hostedtoolcache/PyPy/${PY_LANG}/x64"
29- WANT_MICRO="${PYPY_BUILD#v}"
30- if [ -x "${TARGET}/bin/python3" ]; then
31- CURRENT=$("${TARGET}/bin/python3" -c 'import sys; v=sys.pypy_version_info; print(f"{v.major}.{v.minor}.{v.micro}")') || CURRENT="unknown"
32- echo "Existing toolcache PyPy: ${CURRENT}"
33- if [ "$CURRENT" = "$WANT_MICRO" ]; then
34- echo "PyPy ${WANT_MICRO} already installed; nothing to do."
35- exit 0
36- fi
37- fi
38- echo "Installing PyPy ${PYPY_BUILD} for Python ${PY_LANG} into ${TARGET}..."
39- TARBALL="pypy3.11-${PYPY_BUILD}-linux64.tar.bz2"
40- cd /tmp
41- curl -sSLO "https://downloads.python.org/pypy/${TARBALL}"
42- tar xjf "${TARBALL}"
43- sudo rm -rf "${TARGET}"
44- sudo mkdir -p "$(dirname "${TARGET}")"
45- sudo mv "pypy3.11-${PYPY_BUILD}-linux64" "${TARGET}"
46- # Recreate the python3/python symlinks that the upstream toolcache layout provides.
47- if [ ! -e "${TARGET}/bin/python3" ]; then
48- sudo ln -sf "${TARGET}/bin/pypy3.11" "${TARGET}/bin/python3"
49- fi
50- if [ ! -e "${TARGET}/bin/python" ]; then
51- sudo ln -sf "${TARGET}/bin/pypy3.11" "${TARGET}/bin/python"
52- fi
53- sudo touch "${TARGET}.complete"
54- "${TARGET}/bin/python3" --version
55- # The plain pypy tarball does not include pip; the Azure hosted
56- # toolcache build does. Bootstrap pip via ensurepip so downstream
57- # steps (e.g. `python -m pip install uv`) keep working.
58- if ! "${TARGET}/bin/python3" -c "import pip" >/dev/null 2>&1; then
59- echo "Bootstrapping pip via ensurepip..."
60- sudo "${TARGET}/bin/python3" -m ensurepip --upgrade
61- fi
62- "${TARGET}/bin/python3" -m pip --version
63- env:
64- PYPY_BUILD_VERSION: $(PyPyBuildVersion)
65- PYPY_LANG_VERSION: $(PyPyLangVersion)
66- displayName: 'Override hosted toolcache PyPy build'
67- condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), eq(variables['OverridePyPyVersion'], 'true'))
68-
6915 - task : UsePythonVersion@0
7016 displayName : " Use Python ${{ parameters.versionSpec }}"
7117 inputs :
0 commit comments