Change install-scripts for py3 with Ubuntu
Reworked the pip install logic so that we run the pypi pip installer instead of trying to navigate through running a pip install and upgrade with setuptools additionally. These steps were orginally only done in order to force us to a pip version >= 9.0.1, which is now the default for Ubuntu Bionic. Change-Id: Ic3a95973338bbd03061d5b3e4080c0d72d6b891a
This commit is contained in:
parent
082f3daed4
commit
8a6cdf7d3a
11
bindep.txt
11
bindep.txt
@ -14,9 +14,10 @@ make
|
||||
mariadb [platform:suse]
|
||||
mariadb-server [platform:redhat platform:dpkg]
|
||||
net-tools
|
||||
python [platform:rpm]
|
||||
python-minimal [platform:dpkg]
|
||||
python-devel [platform:rpm]
|
||||
python-dev [platform:dpkg]
|
||||
python-virtualenv
|
||||
python3 [platform:rpm]
|
||||
python3-minimal [platform:dpkg]
|
||||
python3-devel [platform:rpm]
|
||||
python3-dev [platform:dpkg]
|
||||
python3-virtualenv
|
||||
wget
|
||||
sudo
|
||||
|
@ -19,6 +19,10 @@ fi
|
||||
|
||||
PLAYBOOKS_LIBRARY_PATH=$(dirname $0)/../playbooks/library
|
||||
|
||||
|
||||
# NOTE(TheJulia): This should no longer be needed, and was for used to
|
||||
# collect modules from Github where necessary for older ansible versions,
|
||||
# but we should have everything we need with stable-2.6 or later.
|
||||
function check_get_module () {
|
||||
local module=${1}
|
||||
local module_url_base=${2}
|
||||
@ -26,24 +30,6 @@ function check_get_module () {
|
||||
wget "${module_url_base}/${module}.py" -O "${PLAYBOOKS_LIBRARY_PATH}/${module}.py"
|
||||
}
|
||||
|
||||
# Note(TheJulia): These files should be in the ansible library folder
|
||||
# and this functionality exists for a level of ansible 1.9.x
|
||||
# backwards compatability although the modules were developed
|
||||
# for Ansible 2.0.
|
||||
check_get_module os_ironic \
|
||||
https://raw.githubusercontent.com/ansible/ansible-modules-core/stable-2.0/cloud/openstack
|
||||
|
||||
check_get_module os_ironic_node \
|
||||
https://raw.githubusercontent.com/ansible/ansible-modules-core/stable-2.0/cloud/openstack
|
||||
|
||||
# os_ironic_inspect has appeared in Ansible 2.1
|
||||
check_get_module os_ironic_inspect \
|
||||
https://raw.githubusercontent.com/ansible/ansible-modules-extras/stable-2.1/cloud/openstack
|
||||
|
||||
# os_keystone_service has appeared in Ansible 2.2
|
||||
check_get_module os_keystone_service \
|
||||
https://raw.githubusercontent.com/ansible/ansible-modules-extras/stable-2.2/cloud/openstack
|
||||
|
||||
# NOTE(pas-ha) the following is a temporary workaround for third-party CI
|
||||
# scripts that try to source Ansible's hacking/env-setup
|
||||
# after running this very script
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
set -xeu
|
||||
|
||||
declare -A PKG_MAP
|
||||
|
||||
@ -13,8 +13,8 @@ CHECK_CMD_PKGS=(
|
||||
lsb-release
|
||||
make
|
||||
net-tools
|
||||
python-devel
|
||||
python
|
||||
python3-devel
|
||||
python3
|
||||
venv
|
||||
wget
|
||||
)
|
||||
@ -60,9 +60,9 @@ case ${ID,,} in
|
||||
[lsb-release]=lsb-release
|
||||
[make]=make
|
||||
[net-tools]=net-tools
|
||||
[python]=python-minimal
|
||||
[python-devel]=libpython-dev
|
||||
[venv]=python-virtualenv
|
||||
[python3]=python3-minimal
|
||||
[python3-devel]=libpython3-dev
|
||||
[venv]=python3-virtualenv
|
||||
[wget]=wget
|
||||
)
|
||||
EXTRA_PKG_DEPS=()
|
||||
@ -81,15 +81,15 @@ case ${ID,,} in
|
||||
[lsb-release]=redhat-lsb
|
||||
[make]=make
|
||||
[net-tools]=net-tools
|
||||
[python]=python
|
||||
[python-devel]=python-devel
|
||||
[venv]=python-virtualenv
|
||||
[python]=python3
|
||||
[python-devel]=python3-devel
|
||||
[venv]=python3-virtualenv
|
||||
[wget]=wget
|
||||
)
|
||||
EXTRA_PKG_DEPS=()
|
||||
sudo -E ${PKG_MANAGER} updateinfo
|
||||
if $(grep -q Fedora /etc/redhat-release); then
|
||||
EXTRA_PKG_DEPS="python-dnf redhat-rpm-config"
|
||||
EXTRA_PKG_DEPS="python3-dnf redhat-rpm-config"
|
||||
fi
|
||||
;;
|
||||
|
||||
@ -105,8 +105,8 @@ if env | grep -q ^ZUUL; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! $(python --version &>/dev/null); then
|
||||
${INSTALLER_CMD} ${PKG_MAP[python]}
|
||||
if ! $(python3 --version &>/dev/null); then
|
||||
${INSTALLER_CMD} ${PKG_MAP[python3]}
|
||||
fi
|
||||
if ! $(gcc -v &>/dev/null); then
|
||||
${INSTALLER_CMD} ${PKG_MAP[gcc]}
|
||||
@ -115,7 +115,7 @@ if ! $(wget --version &>/dev/null); then
|
||||
${INSTALLER_CMD} ${PKG_MAP[wget]}
|
||||
fi
|
||||
if [ -n "${VENV-}" ]; then
|
||||
if ! $(python -m virtualenv --version &>/dev/null); then
|
||||
if ! $(python3 -m virtualenv --version &>/dev/null); then
|
||||
${INSTALLER_CMD} ${PKG_MAP[venv]}
|
||||
fi
|
||||
fi
|
||||
@ -138,7 +138,7 @@ if [ -n "${VENV-}" ]; then
|
||||
echo "NOTICE: Using virtualenv for this installation."
|
||||
if [ ! -f ${VENV}/bin/activate ]; then
|
||||
# only create venv if one doesn't exist
|
||||
sudo -H -E python -m virtualenv --no-site-packages ${VENV}
|
||||
sudo -H -E python3 -m virtualenv --no-site-packages ${VENV}
|
||||
fi
|
||||
# Note(cinerama): activate is not compatible with "set -u";
|
||||
# disable it just for this line.
|
||||
@ -152,7 +152,7 @@ fi
|
||||
|
||||
# If we're using a venv, we need to work around sudo not
|
||||
# keeping the path even with -E.
|
||||
PYTHON=$(which python)
|
||||
PYTHON=$(which python3)
|
||||
|
||||
# To install python packages, we need pip.
|
||||
#
|
||||
@ -160,31 +160,13 @@ PYTHON=$(which python)
|
||||
# older versions of pip are incompatible with
|
||||
# requests, one of our indirect dependencies (bug 1459947).
|
||||
#
|
||||
# Note(cinerama): We use pip to install an updated pip plus our
|
||||
# other python requirements. pip breakages can seriously impact us,
|
||||
# so we've chosen to install/upgrade pip here rather than in
|
||||
# requirements (which are synced automatically from the global ones)
|
||||
# so we can quickly and easily adjust version parameters.
|
||||
# See bug 1536627.
|
||||
#
|
||||
# Note(cinerama): If pip is linked to pip3, the rest of the install
|
||||
# won't work. Remove the alternatives. This is due to ansible's
|
||||
# python 2.x requirement.
|
||||
if [[ $(readlink -f /etc/alternatives/pip) =~ "pip3" ]]; then
|
||||
sudo -H update-alternatives --remove pip $(readlink -f /etc/alternatives/pip)
|
||||
fi
|
||||
|
||||
if ! which pip; then
|
||||
wget -O /tmp/get-pip.py https://bootstrap.pypa.io/3.2/get-pip.py
|
||||
if [ ! $($PYTHON -m pip install -U pip) ]; then
|
||||
wget -O /tmp/get-pip.py https://bootstrap.pypa.io/3.4/get-pip.py
|
||||
sudo -H -E ${PYTHON} /tmp/get-pip.py
|
||||
fi
|
||||
|
||||
PIP=$(which pip)
|
||||
|
||||
sudo -H -E ${PIP} install --upgrade "pip>6.0"
|
||||
|
||||
# upgrade setuptools, as latest version is needed to install some projects
|
||||
sudo -H -E ${PIP} install --upgrade --force setuptools
|
||||
PIP=$(which pip3)
|
||||
|
||||
if [ "$OS_FAMILY" == "RedHat" ]; then
|
||||
sudo -H -E ${PIP} freeze
|
||||
@ -196,5 +178,7 @@ sudo -H -E ${PIP} install -r "$(dirname $0)/../requirements.txt"
|
||||
# Install the rest of required packages using bindep
|
||||
sudo -H -E ${PIP} install bindep
|
||||
|
||||
echo "Using Bindep to install binary dependencies..."
|
||||
# bindep returns 1 if packages are missing
|
||||
bindep -b &> /dev/null || ${INSTALLER_CMD} $(bindep -b)
|
||||
echo "Completed installation of basic dependencies."
|
||||
|
Loading…
x
Reference in New Issue
Block a user