python2 is EOL, let's move on and only support python3.
Change-Id: Ieffda4edea9cc19484c04420ed703f7141ef9f15
... | ... |
@@ -558,9 +558,6 @@ |
558 | 558 |
devstack_localrc: |
559 | 559 |
SERVICE_IP_VERSION: 6 |
560 | 560 |
SERVICE_HOST: "" |
561 |
- # IPv6 and certificates known issue with python2 |
|
562 |
- # https://bugs.launchpad.net/devstack/+bug/1794929 |
|
563 |
- USE_PYTHON3: true |
|
564 | 561 |
|
565 | 562 |
- job: |
566 | 563 |
name: devstack-multinode |
... | ... |
@@ -430,17 +430,6 @@ Python bindings added when they are enabled. |
430 | 430 |
|
431 | 431 |
ADDITIONAL_VENV_PACKAGES="python-foo, python-bar" |
432 | 432 |
|
433 |
-Use python2 |
|
434 |
- |
|
435 |
-By default ``stack.sh`` uses python3 (the exact version set by the |
|
436 |
-``PYTHON3_VERSION``). This can be overriden so devstack will run |
|
437 |
-python2 (the exact version set by ``PYTHON2_VERSION``). |
|
438 |
- |
|
439 |
-:: |
|
440 |
- |
|
441 |
- USE_PYTHON3=False |
|
442 |
- |
|
443 | 433 |
A clean install every time |
444 | 434 |
-------------------------- |
445 | 435 |
|
... | ... |
@@ -41,9 +41,6 @@ Edit your ``/opt/stack/devstack/local.conf`` to look like |
41 | 41 |
# If you are enabling barbican for TLS offload in Octavia, include it here. |
42 | 42 |
# enable_plugin barbican https://opendev.org/openstack/barbican |
43 | 43 |
|
44 |
- # If you have python3 available: |
|
45 |
- # USE_PYTHON3=True |
|
46 |
- |
|
47 | 44 |
# ===== BEGIN localrc ===== |
48 | 45 |
DATABASE_PASSWORD=password |
49 | 46 |
ADMIN_PASSWORD=password |
... | ... |
@@ -62,7 +62,7 @@ function get_python_exec_prefix { |
62 | 62 |
$xtrace |
63 | 63 |
|
64 | 64 |
local PYTHON_PATH=/usr/local/bin |
65 |
- ( is_fedora && ! python3_enabled ) || is_suse && PYTHON_PATH=/usr/bin |
|
65 |
+ is_suse && PYTHON_PATH=/usr/bin |
|
66 | 66 |
echo $PYTHON_PATH |
67 | 67 |
} |
68 | 68 |
|
... | ... |
@@ -169,16 +169,9 @@ function pip_install { |
169 | 169 |
local cmd_pip=$PIP_VIRTUAL_ENV/bin/pip |
170 | 170 |
local sudo_pip="env" |
171 | 171 |
else |
172 |
- local cmd_pip |
|
173 |
- local sudo_pip="sudo -H" |
|
174 |
- if python3_enabled; then |
|
175 |
- echo "Using python $PYTHON3_VERSION to install $package_dir because python3_enabled=True" |
|
176 |
- sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
|
177 |
- cmd_pip="python$PYTHON3_VERSION -m pip" |
|
178 |
- else |
|
179 |
- echo "Using python $PYTHON2_VERSION to install $package_dir because python3_enabled=False" |
|
180 |
- cmd_pip=$(get_pip_command $PYTHON2_VERSION) |
|
181 |
- fi |
|
172 |
+ local cmd_pip="python$PYTHON3_VERSION -m pip" |
|
173 |
+ local sudo_pip="sudo -H LC_ALL=en_US.UTF-8" |
|
174 |
+ echo "Using python $PYTHON3_VERSION to install $package_dir" |
|
182 | 175 |
fi |
183 | 176 |
|
184 | 177 |
cmd_pip="$cmd_pip install" |
... | ... |
@@ -213,14 +206,8 @@ function pip_uninstall { |
213 | 213 |
local cmd_pip=$PIP_VIRTUAL_ENV/bin/pip |
214 | 214 |
local sudo_pip="env" |
215 | 215 |
else |
216 |
- local cmd_pip |
|
217 |
- local sudo_pip="sudo -H" |
|
218 |
- if python3_enabled; then |
|
219 |
- sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
|
220 |
- cmd_pip="python$PYTHON3_VERSION -m pip" |
|
221 |
- else |
|
222 |
- cmd_pip=$(get_pip_command $PYTHON2_VERSION) |
|
223 |
- fi |
|
216 |
+ local cmd_pip="python$PYTHON3_VERSION -m pip" |
|
217 |
+ local sudo_pip="sudo -H LC_ALL=en_US.UTF-8" |
|
224 | 218 |
fi |
225 | 219 |
# don't error if we can't uninstall, it might not be there |
226 | 220 |
$sudo_pip $cmd_pip uninstall -y $name || /bin/true |
... | ... |
@@ -457,37 +444,15 @@ function setup_package { |
457 | 457 |
} |
458 | 458 |
|
459 | 459 |
# Report whether python 3 should be used |
460 |
+# TODO(frickler): drop this once all legacy uses are removed |
|
460 | 461 |
function python3_enabled { |
461 |
- if [[ $USE_PYTHON3 == "True" ]]; then |
|
462 |
- return 0 |
|
463 |
- else |
|
464 |
- return 1 |
|
465 |
- fi |
|
462 |
+ return 1 |
|
466 | 463 |
} |
467 | 464 |
|
468 | 465 |
# Provide requested python version and sets PYTHON variable |
469 | 466 |
function install_python { |
470 |
- # NOTE: install_python function should finally just do what install_python3 |
|
471 |
- # does as soon Python 2 support has been dropped |
|
472 |
- if python3_enabled; then |
|
473 |
- install_python3 |
|
474 |
- export PYTHON=$(which python${PYTHON3_VERSION} 2>/dev/null || |
|
475 |
- which python3 2>/dev/null) |
|
476 |
- if [[ "${DISTRO}" =~ (rhel8) ]]; then |
|
477 |
- # Use Python 3 as default python command so that we have only one |
|
478 |
- # python alternative to use on the system for either python and |
|
479 |
- # python3 |
|
480 |
- sudo alternatives --set python "${PYTHON}" |
|
481 |
- else |
|
482 |
- # Install anyway Python 2 for legacy scripts that still requires |
|
483 |
- # python instead of python3 command |
|
484 |
- install_package python |
|
485 |
- fi |
|
486 |
- else |
|
487 |
- echo "WARNING - Python 2 support has been deprecated in favor of Python 3" |
|
488 |
- install_package python |
|
489 |
- export PYTHON=$(which python 2>/dev/null) |
|
490 |
- fi |
|
467 |
+ install_python3 |
|
468 |
+ export PYTHON=$(which python${PYTHON3_VERSION} 2>/dev/null) |
|
491 | 469 |
} |
492 | 470 |
|
493 | 471 |
# Install python3 packages |
... | ... |
@@ -89,11 +89,7 @@ function install_apache_uwsgi { |
89 | 89 |
# |
90 | 90 |
# For package installs, the distro ships both plugins and you need |
91 | 91 |
# to select the right one ... it will not be autodetected. |
92 |
- if python3_enabled; then |
|
93 |
- UWSGI_PYTHON_PLUGIN=python3 |
|
94 |
- else |
|
95 |
- UWSGI_PYTHON_PLUGIN=python |
|
96 |
- fi |
|
92 |
+ UWSGI_PYTHON_PLUGIN=python3 |
|
97 | 93 |
|
98 | 94 |
if is_ubuntu; then |
99 | 95 |
local pkg_list="uwsgi uwsgi-plugin-python3 libapache2-mod-proxy-uwsgi" |
... | ... |
@@ -150,14 +146,10 @@ function install_apache_wsgi { |
150 | 150 |
if is_ubuntu; then |
151 | 151 |
# Install apache2, which is NOPRIME'd |
152 | 152 |
install_package apache2 |
153 |
- if python3_enabled; then |
|
154 |
- if is_package_installed libapache2-mod-wsgi; then |
|
155 |
- uninstall_package libapache2-mod-wsgi |
|
156 |
- fi |
|
157 |
- install_package libapache2-mod-wsgi-py3 |
|
158 |
- else |
|
159 |
- install_package libapache2-mod-wsgi |
|
153 |
+ if is_package_installed libapache2-mod-wsgi; then |
|
154 |
+ uninstall_package libapache2-mod-wsgi |
|
160 | 155 |
fi |
156 |
+ install_package libapache2-mod-wsgi-py3 |
|
161 | 157 |
elif is_fedora; then |
162 | 158 |
sudo rm -f /etc/httpd/conf.d/000-* |
163 | 159 |
install_package httpd mod_wsgi |
... | ... |
@@ -227,13 +227,7 @@ function init_CA { |
227 | 227 |
function init_cert { |
228 | 228 |
if [[ ! -r $DEVSTACK_CERT ]]; then |
229 | 229 |
if [[ -n "$TLS_IP" ]]; then |
230 |
- if python3_enabled; then |
|
231 |
- TLS_IP="IP:$TLS_IP" |
|
232 |
- else |
|
233 |
- # Lie to let incomplete match routines work with python2 |
|
234 |
- # see https://bugs.python.org/issue23239 |
|
235 |
- TLS_IP="DNS:$TLS_IP,IP:$TLS_IP" |
|
236 |
- fi |
|
230 |
+ TLS_IP="IP:$TLS_IP" |
|
237 | 231 |
if [[ -n "$HOST_IPV6" ]]; then |
238 | 232 |
TLS_IP="$TLS_IP,IP:$HOST_IPV6" |
239 | 233 |
fi |
... | ... |
@@ -134,25 +134,17 @@ if [[ -r $RC_DIR/.localrc.password ]]; then |
134 | 134 |
fi |
135 | 135 |
|
136 | 136 |
# Control whether Python 3 should be used at all. |
137 |
-export USE_PYTHON3=$(trueorfalse True USE_PYTHON3) |
|
137 |
+# TODO(frickler): Drop this when all consumers are fixed |
|
138 |
+export USE_PYTHON3=True |
|
138 | 139 |
|
139 |
-# When Python 3 is supported by an application, adding the specific |
|
140 |
-# version of Python 3 to this variable will install the app using that |
|
141 |
-# version of the interpreter instead of 2.7. |
|
140 |
+# Adding the specific version of Python 3 to this variable will install |
|
141 |
+# the app using that version of the interpreter instead of just 3. |
|
142 | 142 |
_DEFAULT_PYTHON3_VERSION="$(_get_python_version python3)" |
143 | 143 |
export PYTHON3_VERSION=${PYTHON3_VERSION:-${_DEFAULT_PYTHON3_VERSION:-3}} |
144 | 144 |
|
145 |
-# Just to be more explicit on the Python 2 version to use. |
|
146 |
-_DEFAULT_PYTHON2_VERSION="$(_get_python_version python2)" |
|
147 |
-export PYTHON2_VERSION=${PYTHON2_VERSION:-${_DEFAULT_PYTHON2_VERSION:-2.7}} |
|
148 |
- |
|
149 | 145 |
# Create a virtualenv with this |
150 |
-if [[ ${USE_PYTHON3} == True ]]; then |
|
151 |
- # Use the built-in venv to avoid more dependencies |
|
152 |
- export VIRTUALENV_CMD="python3 -m venv" |
|
153 |
-else |
|
154 |
- export VIRTUALENV_CMD="virtualenv " |
|
155 |
-fi |
|
146 |
+# Use the built-in venv to avoid more dependencies |
|
147 |
+export VIRTUALENV_CMD="python3 -m venv" |
|
156 | 148 |
|
157 | 149 |
# Default for log coloring is based on interactive-or-not. |
158 | 150 |
# Baseline assumption is that non-interactive invocations are for CI, |
... | ... |
@@ -92,9 +92,6 @@ function install_get_pip { |
92 | 92 |
touch $LOCAL_PIP.downloaded |
93 | 93 |
fi |
94 | 94 |
sudo -H -E python${PYTHON3_VERSION} $LOCAL_PIP |
95 |
- if ! python3_enabled; then |
|
96 |
- sudo -H -E python $LOCAL_PIP |
|
97 |
- fi |
|
98 | 95 |
} |
99 | 96 |
|
100 | 97 |
|
... | ... |
@@ -142,9 +139,6 @@ fi |
142 | 142 |
# results in a nonfunctional system. pip on fedora installs to /usr so pip |
143 | 143 |
# can safely override the system pip for all versions of fedora |
144 | 144 |
if ! is_fedora && ! is_suse; then |
145 |
- if is_package_installed python-pip ; then |
|
146 |
- uninstall_package python-pip |
|
147 |
- fi |
|
148 | 145 |
if is_package_installed python3-pip ; then |
149 | 146 |
uninstall_package python3-pip |
150 | 147 |
fi |