Support installing with Python 3 on CentOS 7

RHEL/CentOS 8 dropped support for some older hardware that is still
in use. Since CentOS 7 has Python 3, let's support it for now.

Also fixes an issue with C.UTF-8 locale which does not seem to work on
CentOS 7 (and actually causes a failure with newer python packages).

Change-Id: I1b5797b030ef896ad4b2a95a504a0215ca6ee574
This commit is contained in:
Dmitry Tantsur 2020-07-31 17:13:20 +02:00
parent 040e5f2ce0
commit a28b8fa5bc
3 changed files with 36 additions and 3 deletions

View File

@ -79,6 +79,15 @@
image_type: 'dib'
image_distro: 'centos7'
- job:
name: ironic-python-agent-check-image-dib-centos7-python3
parent: ironic-python-agent-check-image-base
required-projects:
- openstack/diskimage-builder
vars:
image_type: 'dib'
image_distro: 'centos7'
- job:
name: ironic-python-agent-check-image-dib-centos8
parent: ironic-python-agent-check-image-base
@ -133,6 +142,8 @@
- ironic-python-agent-check-image-dib-centos8
- ironic-python-agent-check-image-dib-centos7
# Non-voting jobs
- ironic-python-agent-check-image-dib-centos7-python3:
voting: false
- ironic-python-agent-check-image-dib-fedora:
voting: false
- ironic-python-agent-check-image-dib-debian:

View File

@ -13,11 +13,28 @@ IPADIR=/tmp/ironic-python-agent
UPPER_CONSTRAINTS=/tmp/requirements/upper-constraints.txt
VENVDIR=/opt/ironic-python-agent
IPA_PYTHON_VERSION=$DIB_PYTHON_VERSION
IPA_PYTHON="$DIB_PYTHON"
case "$DISTRO_NAME" in
centos7|rhel7)
# NOTE(dtantsur): C.UTF-8 doesn't seem to exist in CentOS 7
export LC_ALL=en_US.UTF-8
if grep -q 'Python :: 3 :: Only' $IPADIR/setup.cfg; then
echo "WARNING: using Python 3 on CentOS 7, this is not recommended"
${YUM:-yum} install -y python3 python3-devel
IPA_PYTHON=python3
IPA_PYTHON_VERSION=3
fi
;;
esac
# create the virtual environment using the default python
if [ $DIB_PYTHON_VERSION == 3 ]; then
$DIB_PYTHON -m venv $VENVDIR
if [ $IPA_PYTHON_VERSION == 3 ]; then
$IPA_PYTHON -m venv $VENVDIR
else
$DIB_PYTHON -m virtualenv $VENVDIR
$IPA_PYTHON -m virtualenv $VENVDIR
fi
# pip might be an older version which does not support the -c option, therefore

View File

@ -0,0 +1,5 @@
---
features:
- |
Supports building images for Ussuri+ on CentOS 7 using Python 3. This is
not recommended but is necessary for some older hardware.