Files
runner-images/images/linux/scripts/installers/python.sh
T

37 lines
1.3 KiB
Bash
Raw Normal View History

#!/bin/bash
################################################################################
## File: python.sh
2019-12-16 13:47:05 -05:00
## Desc: Installs Python 2/3
################################################################################
# Source the helpers for use with the script
source $HELPER_SCRIPTS/document.sh
2020-05-15 10:18:02 +03:00
source $HELPER_SCRIPTS/os.sh
# Install Python, Python 3, pip, pip3
2020-05-14 17:25:52 +03:00
if isUbuntu20 ; then
apt-get install -y --no-install-recommends python3 python3-dev python3-pip
2020-05-14 17:25:52 +03:00
curl https://bootstrap.pypa.io/get-pip.py --output get-pip.py
python2 get-pip.py
fi
if isUbuntu16 || isUbuntu18 ; then
apt-get install -y --no-install-recommends python python-dev python-pip python3 python3-dev python3-pip
fi
2020-04-30 18:59:02 +03:00
# Run tests to determine that the software installed as expected
echo "Testing to make sure that script performed as expected, and basic scenarios work"
2020-04-30 19:55:52 +03:00
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
fi
done
# Document what was added to the image
echo "Lastly, documenting what we added to the metadata file"
DocumentInstalledItem "Python ($(python --version 2>&1))"
2020-04-30 19:55:52 +03:00
DocumentInstalledItem "pip ($(pip --version))"
2019-12-17 16:20:50 -05:00
DocumentInstalledItem "Python3 ($(python3 --version))"
DocumentInstalledItem "pip3 ($(pip3 --version))"