X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fpython-tools-install.sh;h=e5d836bfcd600d90ab00123be4f4b1d42b76f231;hb=refs%2Ftags%2Fv0.82.3;hp=20a63600d68dc7df074de7e28ab9049aa676792f;hpb=e3b4365df52fdf3fdd6abe86a7fcc4b06c29e181;p=releng%2Fglobal-jjb.git diff --git a/shell/python-tools-install.sh b/shell/python-tools-install.sh index 20a63600..e5d836bf 100644 --- a/shell/python-tools-install.sh +++ b/shell/python-tools-install.sh @@ -12,6 +12,24 @@ echo "---> python-tools-install.sh" set -eufo pipefail +# Souce the python version from lf-env.sh if available. +python="python3" +if [[ -f ~/lf-env.sh ]]; then + source ~/lf-env.sh + lf-activate-venv --python "$python" lftools + # Save the virtualenv path + echo "$lf_venv" > "/tmp/.os_lf_venv" +elif [[ -d /opt/pyenv ]]; then + echo "Setup up pyenv" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + pyenv versions + if command -v pyenv 1>/dev/null 2>&1; then + eval "$(pyenv init - --no-rehash)" + pyenv local "$python" + fi +fi + # This script will typically be called during pre-build & post-build. # Create the user venv during pre-build. if [[ ! -f /tmp/pre-build-complete ]]; then @@ -23,6 +41,7 @@ if [[ ! -f /tmp/pre-build-complete ]]; then echo "Generating Requirements File" cat << 'EOF' > "$requirements_file" +openstacksdk<0.99 python-heatclient python-openstackclient python-magnumclient @@ -51,10 +70,10 @@ EOF fi fi - python3 -m pip install --user --quiet --upgrade pip - python3 -m pip install --user --quiet --no-warn-script-location --upgrade setuptools - python3 -m pip install --user --quiet --no-warn-script-location --upgrade lftools[openstack] - python3 -m pip install --user --quiet --no-warn-script-location --upgrade \ + python3 -m pip install --quiet --upgrade pip + python3 -m pip install --quiet --no-warn-script-location --upgrade setuptools + python3 -m pip install --quiet --no-warn-script-location --upgrade lftools[openstack] + python3 -m pip install --quiet --no-warn-script-location --upgrade \ --upgrade-strategy eager -r "$requirements_file" # installs are silent, show version details in log python3 --version