Add _with_* support to travis python

This commit is contained in:
Peter Šurda 2021-02-14 11:41:17 +01:00
parent 43bf23e4e7
commit 456a458e86
Signed by: PeterSurda
GPG Key ID: 0C5F50C0B5F37D87

View File

@ -80,9 +80,9 @@ function aptinstall() {
function virtualenv_init() {
# init virtualenv directory
if [ -n "$1" -a -n "$2" ]; then
if [ -n "$1" ] && [ -n "$2" ]; then
echo -e "\nvirtualenv -p \"$1\" ~/.venv-$2\n"
virtualenv -p "$1" ~/.venv-"$2"
virtualenv -p "$1" "$3" ~/.venv-"$2"
else
echo -e "\nvirtualenv ~/.venv\n"
virtualenv ~/.venv
@ -159,6 +159,10 @@ if [[ "$(declare -p travis_python)" =~ "declare -a" ]]; then
temp="${pv%\"}"
pv="${temp#\"}"
# strip crap
options=$(echo "$pv"|cut -d_ -f2-)
if [[ "$options" == with* ]]; then
options="--$(echo "$options"|cut -d_ -f2-|tr -- '_' '-')"
fi
pv=$(echo "$pv"|cut -d_ -f1)
ppath=/usr/bin/python$pv
if [ -n "$TRAVIS_PYTHON" ] && [ "$TRAVIS_PYTHON" != "$pv" ]; then
@ -168,7 +172,8 @@ if [[ "$(declare -p travis_python)" =~ "declare -a" ]]; then
#if [ ! -e "$ppath" ]; then
sudo apt -y install "python$pv" "python${pv}-dev"
#fi
virtualenv_init "$ppath" "$pv"
virtualenv_init "$ppath" "$pv" "$options"
virtualenv_activate "$pv"
python_run "$ppath" "$pv"
deactivate