| ... | ... |
@@ -2076,13 +2076,28 @@ function is_provider_network {
|
| 2076 | 2076 |
} |
| 2077 | 2077 |
|
| 2078 | 2078 |
|
| 2079 |
+# Return just the <major>.<minor> for the given python interpreter |
|
| 2080 |
+function _get_python_version {
|
|
| 2081 |
+ local interp=$1 |
|
| 2082 |
+ local version |
|
| 2083 |
+ version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
|
|
| 2084 |
+ echo ${version}
|
|
| 2085 |
+} |
|
| 2086 |
+ |
|
| 2079 | 2087 |
# Return the current python as "python<major>.<minor>" |
| 2080 | 2088 |
function python_version {
|
| 2081 | 2089 |
local python_version |
| 2082 |
- python_version=$(python -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
|
|
| 2090 |
+ python_version=$(_get_python_version python2) |
|
| 2091 |
+ echo "python${python_version}"
|
|
| 2092 |
+} |
|
| 2093 |
+ |
|
| 2094 |
+function python3_version {
|
|
| 2095 |
+ local python3_version |
|
| 2096 |
+ python3_version=$(_get_python_version python3) |
|
| 2083 | 2097 |
echo "python${python_version}"
|
| 2084 | 2098 |
} |
| 2085 | 2099 |
|
| 2100 |
+ |
|
| 2086 | 2101 |
# Service wrapper to restart services |
| 2087 | 2102 |
# restart_service service-name |
| 2088 | 2103 |
function restart_service {
|
| ... | ... |
@@ -130,10 +130,12 @@ export DISABLED_PYTHON3_PACKAGES="" |
| 130 | 130 |
# When Python 3 is supported by an application, adding the specific |
| 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 |
-export PYTHON3_VERSION=${PYTHON3_VERSION:-3.5}
|
|
| 133 |
+_DEFAULT_PYTHON3_VERSION="$(_get_python_version python3)" |
|
| 134 |
+export PYTHON3_VERSION=${PYTHON3_VERSION:-${_DEFAULT_PYTHON3_VERSION}}
|
|
| 134 | 135 |
|
| 135 | 136 |
# Just to be more explicit on the Python 2 version to use. |
| 136 |
-export PYTHON2_VERSION=${PYTHON2_VERSION:-2.7}
|
|
| 137 |
+_DEFAULT_PYTHON2_VERSION="$(_get_python_version python2)" |
|
| 138 |
+export PYTHON2_VERSION=${PYTHON2_VERSION:-${_DEFAULT_PYTHON2_VERSION}}
|
|
| 137 | 139 |
|
| 138 | 140 |
# allow local overrides of env variables, including repo config |
| 139 | 141 |
if [[ -f $RC_DIR/localrc ]]; then |