diff --git a/images/linux/scripts/installers/1604/hosted-tool-cache.sh b/images/linux/scripts/installers/1604/hosted-tool-cache.sh index fe9310cb..c68f9747 100644 --- a/images/linux/scripts/installers/1604/hosted-tool-cache.sh +++ b/images/linux/scripts/installers/1604/hosted-tool-cache.sh @@ -33,8 +33,22 @@ for python in $pythons; do DocumentInstalledItemIndent "Python $python" done; +# PyPy is also configured using the setup-python action +pypys=$(ls $AGENT_TOOLSDIRECTORY/PyPy) +for pypy in $pypys; do + DocumentInstalledItemIndent "PyPy $pypy" + # Add symlinks for pypy2 and pypy3 to usr/local/bin, there should only be 2 versions of PyPy in the tools cache that is downloaded + if [ ${pypy:0:1} -eq "3" ] ; then + # add pypy 3.X to PATH + ln -s $AGENT_TOOLSDIRECTORY/PyPy/$pypy/x64/bin/pypy3 /usr/local/bin/pypy3 + else + # add pypy 2.X to PATH + ln -s $AGENT_TOOLSDIRECTORY/PyPy/$pypy/x64/bin/pypy /usr/local/bin/pypy + fi +done; + DocumentInstalledItem "Ruby:" rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) for ruby in $rubys; do DocumentInstalledItemIndent "Ruby $ruby" -done; +done; \ No newline at end of file diff --git a/images/linux/scripts/installers/1804/hosted-tool-cache.sh b/images/linux/scripts/installers/1804/hosted-tool-cache.sh index 7c6b72d7..10180a24 100644 --- a/images/linux/scripts/installers/1804/hosted-tool-cache.sh +++ b/images/linux/scripts/installers/1804/hosted-tool-cache.sh @@ -33,8 +33,22 @@ for python in $pythons; do DocumentInstalledItemIndent "Python $python" done; +# PyPy is also configured using the setup-python action +pypys=$(ls $AGENT_TOOLSDIRECTORY/PyPy) +for pypy in $pypys; do + DocumentInstalledItemIndent "PyPy $pypy" + # Add symlinks for pypy2 and pypy3 to usr/local/bin, there should only be 2 versions of PyPy in the tools cache that is downloaded + if [ ${pypy:0:1} -eq "3" ] ; then + # add pypy 3.X to PATH + ln -s $AGENT_TOOLSDIRECTORY/PyPy/$pypy/x64/bin/pypy3 /usr/local/bin/pypy3 + else + # add pypy 2.X to PATH + ln -s $AGENT_TOOLSDIRECTORY/PyPy/$pypy/x64/bin/pypy /usr/local/bin/pypy + fi +done; + DocumentInstalledItem "Ruby:" rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) for ruby in $rubys; do DocumentInstalledItemIndent "Ruby $ruby" -done; +done; \ No newline at end of file diff --git a/images/linux/scripts/installers/python.sh b/images/linux/scripts/installers/python.sh index d3b70583..e23d7c0e 100644 --- a/images/linux/scripts/installers/python.sh +++ b/images/linux/scripts/installers/python.sh @@ -1,7 +1,7 @@ #!/bin/bash ################################################################################ ## File: python.sh -## Desc: Installs Python 2/3 and related tools (pip, pypy) +## Desc: Installs Python 2/3 ################################################################################ # Source the helpers for use with the script @@ -10,47 +10,9 @@ source $HELPER_SCRIPTS/document.sh # Install Python, Python 3, pip, pip3 apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip -# Install PyPy 2.7 to $AGENT_TOOLSDIRECTORY -wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy2.7-v7.1.0-linux64.tar.bz2 -tar -x -C /tmp -f /tmp/pypy2.7-v7.1.0-linux64.tar.bz2 -rm /tmp/pypy2.7-v7.1.0-linux64.tar.bz2 -mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/2.7.13 -mv /tmp/pypy2.7-v7.1.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64 -touch $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64.complete - -# add pypy to PATH by default -ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy /usr/local/bin/pypy -# pypy will be the python in PATH when its tools cache directory is prepended to PATH -# PEP 394-style symlinking; don't bother with minor version -ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 -ln -s $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python2 $AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/python - -# Install latest Pip for PyPy2 -$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m ensurepip -$AGENT_TOOLSDIRECTORY/PyPy/2.7.13/x64/bin/pypy -m pip install --ignore-installed pip - -# Install PyPy 3.5 to $AGENT_TOOLSDIRECTORY -wget -q -P /tmp https://bitbucket.org/pypy/pypy/downloads/pypy3.6-v7.2.0-linux64.tar.bz2 -tar -x -C /tmp -f /tmp/pypy3.6-v7.2.0-linux64.tar.bz2 -rm /tmp/pypy3.6-v7.2.0-linux64.tar.bz2 -mkdir -p $AGENT_TOOLSDIRECTORY/PyPy/3.6.9 -mv /tmp/pypy3.6-v7.2.0-linux64 $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64 -touch $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64.complete - -# add pypy3 to PATH by default -ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/pypy3 /usr/local/bin/pypy3 -# pypy3 will be the python in PATH when its tools cache directory is prepended to PATH -# PEP 394-style symlinking; don't bother with minor version -ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/pypy3 $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/python3 -ln -s $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/python3 $AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/python - -# Install latest Pip for PyPy3 -$AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/pypy3 -m ensurepip -$AGENT_TOOLSDIRECTORY/PyPy/3.6.9/x64/bin/pypy3 -m pip install --ignore-installed pip - # Run tests to determine that the software installed as expected echo "Testing to make sure that script performed as expected, and basic scenarios work" -for cmd in python pip pypy python3 pip3 pypy3; do +for cmd in python pip python3 pip3; do if ! command -v $cmd; then echo "$cmd was not installed or not found on PATH" exit 1 @@ -62,6 +24,4 @@ echo "Lastly, documenting what we added to the metadata file" DocumentInstalledItem "Python ($(python --version 2>&1))" DocumentInstalledItem "pip ($(pip --version))" DocumentInstalledItem "Python3 ($(python3 --version))" -DocumentInstalledItem "pip3 ($(pip3 --version))" -DocumentInstalledItem "PyPy2 ($(pypy --version 2>&1 | grep PyPy))" -DocumentInstalledItem "PyPy3 ($(pypy3 --version 2>&1 | grep PyPy))" +DocumentInstalledItem "pip3 ($(pip3 --version))" \ No newline at end of file