From fe9620acd47b960556bc9ee19a1b723880a512aa Mon Sep 17 00:00:00 2001 From: Javier Pena Date: Thu, 14 Feb 2019 15:53:19 +0100 Subject: [PATCH] Fix pip setup for RHEL 8 On RHEL 8, we have no pip but we have pip3, so we need to adapt the pip detection and setup to this. This also requires taking into account a new possible location for packstack.rst, under /usr/local/share. Change-Id: I3b93449fb4b7faabb15a8b186d2be1c174b754b6 --- packstack/installer/basedefs.py | 2 ++ run_tests.sh | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/packstack/installer/basedefs.py b/packstack/installer/basedefs.py index 5a6673747..6a496ee69 100644 --- a/packstack/installer/basedefs.py +++ b/packstack/installer/basedefs.py @@ -38,6 +38,8 @@ if os.path.exists(PACKSTACK_SRC_DOC): PACKSTACK_DOC = PACKSTACK_SRC_DOC elif os.path.exists(os.path.join(sys.prefix, 'share/packstack/packstack.rst')): PACKSTACK_DOC = os.path.join(sys.prefix, 'share/packstack/packstack.rst') +elif os.path.exists('/usr/local/share/packstack/packstack.rst'): + PACKSTACK_DOC = '/usr/local/share/packstack/packstack.rst' else: PACKSTACK_DOC = '/usr/share/packstack/packstack.rst' diff --git a/run_tests.sh b/run_tests.sh index 08a35e9aa..891bfaeab 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -178,7 +178,16 @@ else fi # Don't assume pip is installed -which pip || $SUDO easy_install pip +which pip3 && PIP=pip3 +if [ -z $PIP ]; then + if ([ "$OS_NAME" = "RedHat" ] || [ "$OS_NAME" = "CentOS" ]) && [ $OS_VERSION -gt 7 ]; then + $SUDO $PKG_MGR -y install python3-pip + PIP=pip3 + else + which pip || $SUDO easy_install pip + PIP=pip + fi +fi # Try to use pre-cached cirros images, if available, otherwise download them rm -rf /tmp/cirros @@ -257,7 +266,7 @@ fi # Setup packstack if [ "${INSTALL_FROM_SOURCE}" = true ]; then - $SUDO pip install . + $SUDO $PIP install . # In Fedora when running with sudo gems are installed at /usr/local/bin/ even when GEM_HOME/GEM_BIN_DIR are set if [ "${PKG_MGR}" = "dnf" ]; then export GEM_BIN_DIR=/usr/local/bin/