From 1cda1acc7fd22bc42917c723f14c6ee076098297 Mon Sep 17 00:00:00 2001 From: Michal Arbet Date: Wed, 21 Aug 2024 14:08:34 +0200 Subject: Switch to Dynamic Python Version Detection This commit removes the hardcoded KOLLA_DISTRO_PYTHON_VERSION and replaces it with dynamic Python version detection during container images build. Dockerfiles and scripts now use general python3 references, simplifying maintenance and ensuring compatibility with future Python versions. Test cases relying on distro_python_version were also cleaned up. Change-Id: I891749598247a5e951ed4a873b16acfd0566f59c --- kolla/image/kolla_worker.py | 8 -------- kolla/tests/test_build.py | 18 ------------------ 2 files changed, 26 deletions(-) (limited to 'kolla') diff --git a/kolla/image/kolla_worker.py b/kolla/image/kolla_worker.py index b959ec754..a464d2113 100644 --- a/kolla/image/kolla_worker.py +++ b/kolla/image/kolla_worker.py @@ -114,20 +114,14 @@ class KollaWorker(object): self.rpm_setup = self.build_rpm_setup(rpm_setup_config) if self.base in ['centos', 'rocky']: - self.conf.distro_python_version = "3.9" self.distro_package_manager = 'dnf' self.base_package_type = 'rpm' elif self.base in ['debian']: - self.conf.distro_python_version = "3.11" self.distro_package_manager = 'apt' self.base_package_type = 'deb' elif self.base in ['ubuntu']: - self.conf.distro_python_version = "3.10" self.distro_package_manager = 'apt' self.base_package_type = 'deb' - else: - # Assume worst - self.conf.distro_python_version = "3.8" if self.conf.distro_package_manager is not None: self.distro_package_manager = self.conf.distro_package_manager @@ -147,7 +141,6 @@ class KollaWorker(object): self.image_statuses_unbuildable = dict() self.image_statuses_allowed_to_fail = dict() self.maintainer = conf.maintainer - self.distro_python_version = conf.distro_python_version try: self.engine_client = engine.getEngineClient(self.conf) @@ -326,7 +319,6 @@ class KollaWorker(object): 'kolla_version': kolla_version, 'image_name': image_name, 'users': self.get_users(), - 'distro_python_version': self.distro_python_version, 'distro_package_manager': self.distro_package_manager, 'rpm_setup': self.rpm_setup, 'build_date': build_date, diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py index afbfe009c..9b3719c07 100644 --- a/kolla/tests/test_build.py +++ b/kolla/tests/test_build.py @@ -661,24 +661,6 @@ class KollaWorkerTest(base.TestCase): kolla = build.KollaWorker(self.conf) self.assertEqual(2, len(kolla.rpm_setup)) - def test_build_distro_python_version_debian(self): - """check distro_python_version for Debian""" - self.conf.set_override('base', 'debian') - kolla = build.KollaWorker(self.conf) - self.assertEqual('3.11', kolla.distro_python_version) - - def test_build_distro_python_version_ubuntu(self): - """check distro_python_version for Ubuntu""" - self.conf.set_override('base', 'ubuntu') - kolla = build.KollaWorker(self.conf) - self.assertEqual('3.10', kolla.distro_python_version) - - def test_build_distro_python_version_centos(self): - """check distro_python_version for CentOS Stream 9""" - self.conf.set_override('base', 'centos') - kolla = build.KollaWorker(self.conf) - self.assertEqual('3.9', kolla.distro_python_version) - def test_build_distro_package_manager(self): """check distro_package_manager conf value is taken""" self.conf.set_override('distro_package_manager', 'foo') -- cgit v1.2.3