Merge "Provide an option to force pip --upgrade"
This commit is contained in:
commit
2a5f1addf2
@ -247,6 +247,21 @@ A clean install every time
|
|||||||
|
|
||||||
RECLONE=yes
|
RECLONE=yes
|
||||||
|
|
||||||
|
Upgrade packages installed by pip
|
||||||
|
---------------------------------
|
||||||
|
|
||||||
|
| *Default: ``PIP_UPGRADE=""``*
|
||||||
|
| By default ``stack.sh`` only installs Python packages if no version
|
||||||
|
is currently installed or the current version does not match a specified
|
||||||
|
requirement. If ``PIP_UPGRADE`` is set to ``True`` then existing required
|
||||||
|
Python packages will be upgraded to the most recent version that
|
||||||
|
matches requirements.
|
||||||
|
|
|
||||||
|
|
||||||
|
::
|
||||||
|
|
||||||
|
PIP_UPGRADE=True
|
||||||
|
|
||||||
Swift
|
Swift
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
12
inc/python
12
inc/python
@ -54,17 +54,23 @@ function get_python_exec_prefix {
|
|||||||
|
|
||||||
# Wrapper for ``pip install`` to set cache and proxy environment variables
|
# Wrapper for ``pip install`` to set cache and proxy environment variables
|
||||||
# Uses globals ``INSTALL_TESTONLY_PACKAGES``, ``OFFLINE``, ``PIP_VIRTUAL_ENV``,
|
# Uses globals ``INSTALL_TESTONLY_PACKAGES``, ``OFFLINE``, ``PIP_VIRTUAL_ENV``,
|
||||||
# ``TRACK_DEPENDS``, ``*_proxy``
|
# ``PIP_UPGRADE``, ``TRACK_DEPENDS``, ``*_proxy``
|
||||||
# pip_install package [package ...]
|
# pip_install package [package ...]
|
||||||
function pip_install {
|
function pip_install {
|
||||||
local xtrace=$(set +o | grep xtrace)
|
local xtrace=$(set +o | grep xtrace)
|
||||||
set +o xtrace
|
set +o xtrace
|
||||||
|
local upgrade=""
|
||||||
local offline=${OFFLINE:-False}
|
local offline=${OFFLINE:-False}
|
||||||
if [[ "$offline" == "True" || -z "$@" ]]; then
|
if [[ "$offline" == "True" || -z "$@" ]]; then
|
||||||
$xtrace
|
$xtrace
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
PIP_UPGRADE=$(trueorfalse False PIP_UPGRADE)
|
||||||
|
if [[ "$PIP_UPGRADE" = "True" ]] ; then
|
||||||
|
upgrade="--upgrade"
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ -z "$os_PACKAGE" ]]; then
|
if [[ -z "$os_PACKAGE" ]]; then
|
||||||
GetOSVersion
|
GetOSVersion
|
||||||
fi
|
fi
|
||||||
@ -98,7 +104,7 @@ function pip_install {
|
|||||||
https_proxy="${https_proxy:-}" \
|
https_proxy="${https_proxy:-}" \
|
||||||
no_proxy="${no_proxy:-}" \
|
no_proxy="${no_proxy:-}" \
|
||||||
PIP_FIND_LINKS=$PIP_FIND_LINKS \
|
PIP_FIND_LINKS=$PIP_FIND_LINKS \
|
||||||
$cmd_pip install \
|
$cmd_pip install $upgrade \
|
||||||
$@
|
$@
|
||||||
|
|
||||||
# Also install test requirements
|
# Also install test requirements
|
||||||
@ -110,7 +116,7 @@ function pip_install {
|
|||||||
https_proxy=${https_proxy:-} \
|
https_proxy=${https_proxy:-} \
|
||||||
no_proxy=${no_proxy:-} \
|
no_proxy=${no_proxy:-} \
|
||||||
PIP_FIND_LINKS=$PIP_FIND_LINKS \
|
PIP_FIND_LINKS=$PIP_FIND_LINKS \
|
||||||
$cmd_pip install \
|
$cmd_pip install $upgrade \
|
||||||
-r $test_req
|
-r $test_req
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user