add suse_py311 flavor to explicitly render templates for py311

This is needed when py 3.11 is not the primary python version
(e.g. SLE15).

Change-Id: I362ec318a0c63f54469eb3267b5b8d868856bbdf
This commit is contained in:
Dirk Müller 2024-01-07 14:48:17 +01:00
parent 3c045314de
commit 520ee43dab
No known key found for this signature in database
2 changed files with 24 additions and 1 deletions

View File

@ -118,6 +118,20 @@ def default_suse_py39_tr(mod):
return (pkg, py2pkg, py3pkg)
def default_suse_py311_tr(mod):
"""
Default translation function for openSUSE, SLES, and other
SUSE based systems that have python 3.11
Returns a tuple of 3 elements - the unversioned name, the python2 versioned
name and the python3 versioned name.
"""
pkg = 'python-%s' % mod
py2pkg = 'python2-%s' % mod
py3pkg = 'python311-%s' % mod
return (pkg, py2pkg, py3pkg)
def openstack_prefix_tr(mod):
pkg = 'openstack-' + mod.lower()
return (pkg, pkg, pkg)
@ -330,6 +344,11 @@ SUSE_PY39_PKG_MAP.extend([
SingleRule('devel', 'python-devel', 'python39-devel'),
])
SUSE_PY311_PKG_MAP = SUSE_COMMON_PKG_MAP
SUSE_PY311_PKG_MAP.extend([
SingleRule('devel', 'python-devel', 'python311-devel'),
])
UBUNTU_PKG_MAP = [
SingleRule('glance_store', 'python-glance-store'),
SingleRule('GitPython', 'python-git'),
@ -369,6 +388,8 @@ def get_pkg_map(dist):
d_lower = dist.lower()
if 'suse_py39' in d_lower:
return SUSE_PY39_PKG_MAP
if 'suse_py311' in d_lower:
return SUSE_PY311_PKG_MAP
if 'suse' in d_lower or 'sles' in d_lower:
return SUSE_PKG_MAP
if 'ubuntu' in d_lower:
@ -380,6 +401,8 @@ def get_default_tr_func(dist):
d_lower = dist.lower()
if 'suse_py39' in d_lower:
return default_suse_py39_tr
if 'suse_py311' in d_lower:
return default_suse_py311_tr
if 'suse' in d_lower or 'sles' in d_lower:
return default_suse_tr
if 'ubuntu' in d_lower:

View File

@ -20,7 +20,7 @@ commands = stestr run {posargs}
[testenv:pep8]
deps = {[testenv]deps}
flake8<4.0.0,>=3.9.2
flake8<7.1.0,>=7.0.0
commands = flake8
[testenv:venv]