Make it possible for someone to config
PIP_UPGRADE=True
in local.conf and thus force pip_install calls to upgrade. In
automated testing this is probably a bad idea, but in manual testing
or situations where devstack is being used to spin up proof of
concepts having the option to use the latest and greatest Python
modules is a useful way of exploring the health of the ecosystem.
To help with visibility of the setting, and section has been added
in configuration.rst near other similar settings.
Change-Id: I484c954f1e1f05ed02c0b08e8e4a9c18558c05ef
... | ... |
@@ -247,6 +247,21 @@ A clean install every time |
247 | 247 |
|
248 | 248 |
RECLONE=yes |
249 | 249 |
|
250 |
+Upgrade packages installed by pip |
|
251 |
+--------------------------------- |
|
252 |
+ |
|
253 |
+ | *Default: ``PIP_UPGRADE=""``* |
|
254 |
+ | By default ``stack.sh`` only installs Python packages if no version |
|
255 |
+ is currently installed or the current version does not match a specified |
|
256 |
+ requirement. If ``PIP_UPGRADE`` is set to ``True`` then existing required |
|
257 |
+ Python packages will be upgraded to the most recent version that |
|
258 |
+ matches requirements. |
|
259 |
+ | |
|
260 |
+ |
|
261 |
+ :: |
|
262 |
+ |
|
263 |
+ PIP_UPGRADE=True |
|
264 |
+ |
|
250 | 265 |
Swift |
251 | 266 |
----- |
252 | 267 |
|
... | ... |
@@ -54,17 +54,23 @@ function get_python_exec_prefix { |
54 | 54 |
|
55 | 55 |
# Wrapper for ``pip install`` to set cache and proxy environment variables |
56 | 56 |
# Uses globals ``INSTALL_TESTONLY_PACKAGES``, ``OFFLINE``, ``PIP_VIRTUAL_ENV``, |
57 |
-# ``TRACK_DEPENDS``, ``*_proxy`` |
|
57 |
+# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy`` |
|
58 | 58 |
# pip_install package [package ...] |
59 | 59 |
function pip_install { |
60 | 60 |
local xtrace=$(set +o | grep xtrace) |
61 | 61 |
set +o xtrace |
62 |
+ local upgrade="" |
|
62 | 63 |
local offline=${OFFLINE:-False} |
63 | 64 |
if [[ "$offline" == "True" || -z "$@" ]]; then |
64 | 65 |
$xtrace |
65 | 66 |
return |
66 | 67 |
fi |
67 | 68 |
|
69 |
+ PIP_UPGRADE=$(trueorfalse False PIP_UPGRADE) |
|
70 |
+ if [[ "$PIP_UPGRADE" = "True" ]] ; then |
|
71 |
+ upgrade="--upgrade" |
|
72 |
+ fi |
|
73 |
+ |
|
68 | 74 |
if [[ -z "$os_PACKAGE" ]]; then |
69 | 75 |
GetOSVersion |
70 | 76 |
fi |
... | ... |
@@ -98,7 +104,7 @@ function pip_install { |
98 | 98 |
https_proxy="${https_proxy:-}" \ |
99 | 99 |
no_proxy="${no_proxy:-}" \ |
100 | 100 |
PIP_FIND_LINKS=$PIP_FIND_LINKS \ |
101 |
- $cmd_pip install \ |
|
101 |
+ $cmd_pip install $upgrade \ |
|
102 | 102 |
$@ |
103 | 103 |
|
104 | 104 |
# Also install test requirements |
... | ... |
@@ -110,7 +116,7 @@ function pip_install { |
110 | 110 |
https_proxy=${https_proxy:-} \ |
111 | 111 |
no_proxy=${no_proxy:-} \ |
112 | 112 |
PIP_FIND_LINKS=$PIP_FIND_LINKS \ |
113 |
- $cmd_pip install \ |
|
113 |
+ $cmd_pip install $upgrade \ |
|
114 | 114 |
-r $test_req |
115 | 115 |
fi |
116 | 116 |
} |