Files
runner-images/images/macos/provision/core/python.sh
T

31 lines
1.0 KiB
Bash
Raw Normal View History

#!/bin/bash -e -o pipefail
source ~/utils/utils.sh
2020-09-10 14:34:08 +03:00
echo "Installing Python Tooling"
2020-12-08 21:29:39 +03:00
echo "Install latest Python 2"
Python2Url="https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg"
download_with_retries $Python2Url "/tmp" "python2.pkg"
sudo installer -pkg /tmp/python2.pkg -target /
pip install --upgrade pip
echo "Install Python2 certificates"
bash -c "/Applications/Python\ 2.7/Install\ Certificates.command"
2020-10-07 09:29:37 +03:00
# Explicitly overwrite symlinks created by Python2 such as /usr/local/bin/2to3 since they conflict with symlinks from Python3
# https://github.com/actions/virtual-environments/issues/2322
echo "Brew Installing Python 3"
brew_smart_install "python@3.9" || brew link --overwrite python@3.9
2020-10-07 09:29:37 +03:00
echo "Installing pipx"
2020-10-07 14:58:13 +03:00
export PIPX_BIN_DIR=/usr/local/opt/pipx_bin
export PIPX_HOME=/usr/local/opt/pipx
2020-10-07 09:29:37 +03:00
brew_smart_install "pipx"
2020-10-07 09:29:37 +03:00
echo "export PIPX_BIN_DIR=${PIPX_BIN_DIR}" >> "${HOME}/.bashrc"
echo "export PIPX_HOME=${PIPX_HOME}" >> "${HOME}/.bashrc"
echo 'export PATH="$PIPX_BIN_DIR:$PATH"' >> "${HOME}/.bashrc"
invoke_tests "Python"