Fix devstack python detection if python3 is missing
On platforms without python3 installed devstack fails the python version check. This does it more gracefully. Change-Id: I4d79a41eb2d66852ab1a1aa8bd383f8e3e89cdc0
This commit is contained in:
parent
71e07c738d
commit
4324f4ecd9
@ -2080,7 +2080,10 @@ function is_provider_network {
|
|||||||
function _get_python_version {
|
function _get_python_version {
|
||||||
local interp=$1
|
local interp=$1
|
||||||
local version
|
local version
|
||||||
version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
|
# disable erroring out here, otherwise if python 3 doesn't exist we fail hard.
|
||||||
|
if [[ -x $(which $interp) ]]; then
|
||||||
|
version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
|
||||||
|
fi
|
||||||
echo ${version}
|
echo ${version}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
stackrc
4
stackrc
@ -131,11 +131,11 @@ export DISABLED_PYTHON3_PACKAGES=""
|
|||||||
# version of Python 3 to this variable will install the app using that
|
# version of Python 3 to this variable will install the app using that
|
||||||
# version of the interpreter instead of 2.7.
|
# version of the interpreter instead of 2.7.
|
||||||
_DEFAULT_PYTHON3_VERSION="$(_get_python_version python3)"
|
_DEFAULT_PYTHON3_VERSION="$(_get_python_version python3)"
|
||||||
export PYTHON3_VERSION=${PYTHON3_VERSION:-${_DEFAULT_PYTHON3_VERSION}}
|
export PYTHON3_VERSION=${PYTHON3_VERSION:-${_DEFAULT_PYTHON3_VERSION:-3.5}}
|
||||||
|
|
||||||
# Just to be more explicit on the Python 2 version to use.
|
# Just to be more explicit on the Python 2 version to use.
|
||||||
_DEFAULT_PYTHON2_VERSION="$(_get_python_version python2)"
|
_DEFAULT_PYTHON2_VERSION="$(_get_python_version python2)"
|
||||||
export PYTHON2_VERSION=${PYTHON2_VERSION:-${_DEFAULT_PYTHON2_VERSION}}
|
export PYTHON2_VERSION=${PYTHON2_VERSION:-${_DEFAULT_PYTHON2_VERSION:-2.7}}
|
||||||
|
|
||||||
# allow local overrides of env variables, including repo config
|
# allow local overrides of env variables, including repo config
|
||||||
if [[ -f $RC_DIR/localrc ]]; then
|
if [[ -f $RC_DIR/localrc ]]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user