From 65c6da58c3498c92633860dccdc506bd15b5912c Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Wed, 22 Feb 2017 19:59:44 +0100 Subject: [PATCH] [suse] Handle pip-and-virtualenv install for opensuse Similarly to Fedora we need to register the virtualenv package with the rpm database to avoid things becoming messy later on when package dependencies are conflicting with the from-source install. Change-Id: I67654fe5533e6086a17b38e2ae79a630a609ff92 --- .../04-install-pip | 37 +++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip b/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip index 474c89983..4014c98f7 100755 --- a/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip +++ b/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip @@ -6,7 +6,7 @@ fi set -eu set -o pipefail -if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then +if [[ $DISTRO_NAME =~ (opensuse}fedora|centos|centos7|rhel|rhel7) ]]; then # GENERAL WARNING : mixing packaged python libraries with # pip-installed versions always creates issues. Upstream # openstack-infra uses this a lot (especially devstack) but be @@ -16,7 +16,11 @@ if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then # on somebody does a "yum install python-virtualenv" and goes and # overwrites the pip installed version with the packaged version, # leading to all sorts of weird version issues. - ${YUM:-yum} install -y python-virtualenv python-pip python-setuptools + if [[ $DISTRO_NAME = opensuse ]]; then + zypper -n install python-virtualenv python-pip python-setuptools + else + ${YUM:-yum} install -y python-virtualenv python-pip python-setuptools + fi # install pip; this overwrites packaged pip /usr/local/bin/dib-python /tmp/get-pip.py @@ -38,17 +42,28 @@ if [[ $DISTRO_NAME =~ (fedora|centos|centos7|rhel|rhel7) ]]; then # doesn't have issues with other system packages. pip install -U virtualenv - # Add this to exclude so that we don't install a later package - # over it if it updates. Note that fedora-minimal, bootstrapped - # via yum, can have an old yum.conf around, so look for dnf first. - if [[ -f /etc/dnf/dnf.conf ]]; then - conf=/etc/dnf/dnf.conf - elif [[ -f /etc/yum.conf ]]; then - conf=/etc/yum.conf + if [[ $DISTRO_NAME = opensuse ]]; then + for pkg in virtualenv pip setuptools; do + cat - >> /etc/zypp/locks <> ${conf} fi - echo "exclude=python-virtualenv,python-pip,python-setuptools" >> ${conf} else /usr/local/bin/dib-python /tmp/get-pip.py pip install virtualenv