diskimage-builder/elements/dib-python/environment.d/50-dib-python-version
Ian Wienand 2978ff885b Revert Xenial to Python 2
There are issues with pip packages and a python3 only Xenial systems.
This is occuring after Ie609de51cc5fcde701296c9474e315981d9778a2.

We believe the issue is with VIRTUAL_ENV being set within the chroot
and messing up pip installs
(Icdb769541eee9793f261b4b8ec563be76ee13fe2) but a full solution is not
yet clear.

For now, set Xenial to ensure we use python2.  Install the package for
the ubuntu element (75-debian-minimal-baseinstall will install python2
for the minimal elements).

Change-Id: Id403919b0af93b375a900186c01a0d3a3bdfafea
2016-12-21 20:46:13 +11:00

33 lines
1002 B
Plaintext

# Pick which distros we need to force python2
if [ -z "${DIB_PYTHON_VERSION:-}" ]; then
if [ "$DISTRO_NAME" == "ubuntu" ]; then
if [ "$DIB_RELEASE" == "precise" ]; then
DIB_PYTHON_VERSION=2
elif [ "$DIB_RELEASE" == "trusty" ]; then
DIB_PYTHON_VERSION=2
elif [ "$DIB_RELEASE" == "xenial" ]; then
DIB_PYTHON_VERSION=2
fi
elif [ "$DISTRO_NAME" == "debian" ]; then
DIB_PYTHON_VERSION=2
elif [ "$DISTRO_NAME" == "fedora" ]; then
if [ "$DIB_RELEASE" -le 22 ]; then
DIB_PYTHON_VERSION=2
fi
elif [ "$DISTRO_NAME" == "centos" ]; then
DIB_PYTHON_VERSION=2
elif [ "$DISTRO_NAME" == "centos7" ]; then
DIB_PYTHON_VERSION=2
elif [ "$DISTRO_NAME" == "rhel7" ]; then
DIB_PYTHON_VERSION=2
elif [ "$DISTRO_NAME" == "opensuse" ]; then
DIB_PYTHON_VERSION=2
fi
fi
if [ -z "${DIB_PYTHON_VERSION:-}" ]; then
DIB_PYTHON_VERSION=3
fi
export DIB_PYTHON_VERSION