From cf7d39e4cda35ecbd1e88c8c628e082f46c7e6e2 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Wed, 5 Feb 2020 11:42:52 +0100 Subject: [PATCH] Allow python3 to be used in Debian Debian default Python interpreter version is 2.7, but it's possible to install a Python 3 interpreter from the base repository. With this change, if we set DIB_PYTHON_VERSION to 3, we install the python3 package from base, with python3-libs, python3-pip and python3-setuptools, and redefine python_path, effectively allowing Python 3 interpreter to be used in Debian. See a result of the job for building the ipa image here: https://review.opendev.org/705773 Change-Id: Idabfa94c2bff6e0de6daa0866084d5db14d7dcb0 --- .../elements/dib-python/pre-install.d/01-dib-python | 3 +++ 1 file changed, 3 insertions(+) diff --git a/diskimage_builder/elements/dib-python/pre-install.d/01-dib-python b/diskimage_builder/elements/dib-python/pre-install.d/01-dib-python index 8142547d..5bcb3623 100755 --- a/diskimage_builder/elements/dib-python/pre-install.d/01-dib-python +++ b/diskimage_builder/elements/dib-python/pre-install.d/01-dib-python @@ -11,6 +11,9 @@ if [[ ${DISTRO_NAME} =~ (centos|rhel) && ${DIB_RELEASE} == 8 ]]; then # a good idea, abstracting the python binary for system scripts! # :) Use it for dib-python. python_path=/usr/libexec/platform-python +elif [[ ${DISTRO_NAME} =~ (debian) && ${DIB_PYTHON_VERSION} == 3 ]]; then + apt-get install -y python3 + python_path=$(command -v python${DIB_PYTHON_VERSION}) else python_path=$(command -v python${DIB_PYTHON_VERSION}) fi