On platforms without python3 installed devstack fails the python
version check. This does it more gracefully.
Change-Id: I4d79a41eb2d66852ab1a1aa8bd383f8e3e89cdc0
| ... | ... |
@@ -2080,7 +2080,10 @@ function is_provider_network {
|
| 2080 | 2080 |
function _get_python_version {
|
| 2081 | 2081 |
local interp=$1 |
| 2082 | 2082 |
local version |
| 2083 |
- version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
|
|
| 2083 |
+ # disable erroring out here, otherwise if python 3 doesn't exist we fail hard. |
|
| 2084 |
+ if [[ -x $(which $interp) ]]; then |
|
| 2085 |
+ version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
|
|
| 2086 |
+ fi |
|
| 2084 | 2087 |
echo ${version}
|
| 2085 | 2088 |
} |
| 2086 | 2089 |
|
| ... | ... |
@@ -131,11 +131,11 @@ export DISABLED_PYTHON3_PACKAGES="" |
| 131 | 131 |
# version of Python 3 to this variable will install the app using that |
| 132 | 132 |
# version of the interpreter instead of 2.7. |
| 133 | 133 |
_DEFAULT_PYTHON3_VERSION="$(_get_python_version python3)" |
| 134 |
-export PYTHON3_VERSION=${PYTHON3_VERSION:-${_DEFAULT_PYTHON3_VERSION}}
|
|
| 134 |
+export PYTHON3_VERSION=${PYTHON3_VERSION:-${_DEFAULT_PYTHON3_VERSION:-3.5}}
|
|
| 135 | 135 |
|
| 136 | 136 |
# Just to be more explicit on the Python 2 version to use. |
| 137 | 137 |
_DEFAULT_PYTHON2_VERSION="$(_get_python_version python2)" |
| 138 |
-export PYTHON2_VERSION=${PYTHON2_VERSION:-${_DEFAULT_PYTHON2_VERSION}}
|
|
| 138 |
+export PYTHON2_VERSION=${PYTHON2_VERSION:-${_DEFAULT_PYTHON2_VERSION:-2.7}}
|
|
| 139 | 139 |
|
| 140 | 140 |
# allow local overrides of env variables, including repo config |
| 141 | 141 |
if [[ -f $RC_DIR/localrc ]]; then |