aboutsummaryrefslogtreecommitdiff
path: root/kolla/image
diff options
context:
space:
mode:
authorMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2019-03-08 13:19:03 +0100
committerMarcin Juszkiewicz <marcin.juszkiewicz@linaro.org>2019-03-12 17:13:46 +0000
commit8df6eb01184672ffdc752437ea4d98d13f16026e (patch)
treee4121f587d342afa739a6ffde89074d978eea648 /kolla/image
parent8ae32bb17258a2211e03592bfaae6c648cda6089 (diff)
downloadkolla-8df6eb01184672ffdc752437ea4d98d13f16026e.tar.gz
kolla-8df6eb01184672ffdc752437ea4d98d13f16026e.zip
replace 'distro_python3' variable with 'distro_python_version'
RHEL7 derived distros use Python 2.7 RHEL8 uses Python 3.6 Ubuntu 18.04 uses Python 3.6, but we haven't enabled it yet. Debian:buster uses Python 3.7, but we haven't enabled it yet. We have several places in code where "/lib/pythonX.Y/site-packages" is used so we need to know value of X.Y rather than py2/py3 switch. How to check for Python 2: {% if distro_python_version == '2.7' %} Breaks: Iad6b70b433a0dd1b0f8ae6790fd280594517661a Change-Id: Ie24f109af19ae0438c21e0d43cb3cc947812b4ce
Diffstat (limited to 'kolla/image')
-rwxr-xr-xkolla/image/build.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/kolla/image/build.py b/kolla/image/build.py
index 0306d9b2b..624db3406 100755
--- a/kolla/image/build.py
+++ b/kolla/image/build.py
@@ -693,13 +693,13 @@ class KollaWorker(object):
deb_base = ['ubuntu', 'debian']
deb_type = ['source', 'binary']
- if self.conf.distro_python3 is not None:
- self.distro_python3 = self.conf.distro_python3
- elif self.base in rh_base and self.base_tag in ['8']:
- # RHEL 8+ is python3
- self.distro_python3 = True
+ if self.base in rh_base and self.base_tag.startswith('7'):
+ self.conf.distro_python_version = "2.7"
+ elif self.base in rh_base and self.base_tag.startswith('8'):
+ self.conf.distro_python_version = "3.6"
else:
- self.distro_python3 = False
+ # Assume worst
+ self.conf.distro_python_version = "2.7"
# Determine base packaging type for use in Dockerfiles.
if self.conf.base_package_type:
@@ -738,6 +738,7 @@ class KollaWorker(object):
self.image_statuses_unmatched = dict()
self.image_statuses_skipped = dict()
self.maintainer = conf.maintainer
+ self.distro_python_version = conf.distro_python_version
docker_kwargs = docker.utils.kwargs_from_env()
try:
@@ -915,7 +916,7 @@ class KollaWorker(object):
'kolla_version': kolla_version,
'image_name': image_name,
'users': self.get_users(),
- 'distro_python3': self.distro_python3,
+ 'distro_python_version': self.distro_python_version,
'rpm_setup': self.rpm_setup,
'build_date': build_date}
env = jinja2.Environment( # nosec: not used to render HTML