Merge pull request #168 from konradpabjan/master

Use toolcache for PyPy on Ubuntu 1604 and 1804
This commit is contained in:
Alejandro Pauly
2019-12-20 08:47:35 -05:00
committed by GitHub
3 changed files with 33 additions and 45 deletions

View File

@@ -33,8 +33,22 @@ for python in $pythons; do
DocumentInstalledItemIndent "Python $python" DocumentInstalledItemIndent "Python $python"
done; 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:" DocumentInstalledItem "Ruby:"
rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby)
for ruby in $rubys; do for ruby in $rubys; do
DocumentInstalledItemIndent "Ruby $ruby" DocumentInstalledItemIndent "Ruby $ruby"
done; done;

View File

@@ -33,8 +33,22 @@ for python in $pythons; do
DocumentInstalledItemIndent "Python $python" DocumentInstalledItemIndent "Python $python"
done; 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:" DocumentInstalledItem "Ruby:"
rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby) rubys=$(ls $AGENT_TOOLSDIRECTORY/Ruby)
for ruby in $rubys; do for ruby in $rubys; do
DocumentInstalledItemIndent "Ruby $ruby" DocumentInstalledItemIndent "Ruby $ruby"
done; done;

View File

@@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
################################################################################ ################################################################################
## File: python.sh ## 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 # Source the helpers for use with the script
@@ -10,47 +10,9 @@ source $HELPER_SCRIPTS/document.sh
# Install Python, Python 3, pip, pip3 # Install Python, Python 3, pip, pip3
apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip 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 # Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work" 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 if ! command -v $cmd; then
echo "$cmd was not installed or not found on PATH" echo "$cmd was not installed or not found on PATH"
exit 1 exit 1
@@ -62,6 +24,4 @@ echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Python ($(python --version 2>&1))" DocumentInstalledItem "Python ($(python --version 2>&1))"
DocumentInstalledItem "pip ($(pip --version))" DocumentInstalledItem "pip ($(pip --version))"
DocumentInstalledItem "Python3 ($(python3 --version))" DocumentInstalledItem "Python3 ($(python3 --version))"
DocumentInstalledItem "pip3 ($(pip3 --version))" DocumentInstalledItem "pip3 ($(pip3 --version))"
DocumentInstalledItem "PyPy2 ($(pypy --version 2>&1 | grep PyPy))"
DocumentInstalledItem "PyPy3 ($(pypy3 --version 2>&1 | grep PyPy))"