uninstall libvirt-python and reinstall

libvirt-python compiles against the currently installed libvirt. If
you upgrade that, it needs to rebuild, however it won't change
versions, so pip install just noops. Force an uninstall / reinstall of
it every time to handle potential upgrades of libvirt.

Change-Id: If34541b34aa6d55eedaf6c603fd1fe92eb887308
This commit is contained in:
Sean Dague 2017-05-07 22:02:10 -04:00
parent 2b88b323c9
commit f28e7ef6ba
2 changed files with 17 additions and 0 deletions

View File

@ -351,6 +351,20 @@ function pip_install {
return $result
}
function pip_uninstall {
local name=$1
if [[ -n ${PIP_VIRTUAL_ENV:=} && -d ${PIP_VIRTUAL_ENV} ]]; then
local cmd_pip=$PIP_VIRTUAL_ENV/bin/pip
local sudo_pip="env"
else
local cmd_pip
cmd_pip=$(get_pip_command $PYTHON2_VERSION)
local sudo_pip="sudo -H"
fi
# don't error if we can't uninstall, it might not be there
$sudo_pip $cmd_pip uninstall $name || /bin/true
}
# get version of a package from global requirements file
# get_from_global_requirements <package>
function get_from_global_requirements {

View File

@ -67,6 +67,8 @@ function install_libvirt {
else
install_package libvirt-clients libvirt-daemon-system libvirt-dev
fi
# uninstall in case the libvirt version changed
pip_uninstall libvirt-python
pip_install_gr libvirt-python
#pip_install_gr <there-si-no-guestfs-in-pypi>
elif is_fedora || is_suse; then
@ -84,6 +86,7 @@ function install_libvirt {
fi
install_package libvirt libvirt-devel
pip_uninstall libvirt-python
pip_install_gr libvirt-python
fi