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
This commit is contained in:
Javier Pena 2019-02-14 15:53:19 +01:00
parent d84fd14687
commit fe9620acd4
2 changed files with 13 additions and 2 deletions

View File

@ -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'

View File

@ -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/