From 520ee43daba01eca0d767bbe6fdfe79857e63b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Sun, 7 Jan 2024 14:48:17 +0100 Subject: [PATCH] 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 --- pymod2pkg/__init__.py | 23 +++++++++++++++++++++++ tox.ini | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/pymod2pkg/__init__.py b/pymod2pkg/__init__.py index a369cab..710ff02 100644 --- a/pymod2pkg/__init__.py +++ b/pymod2pkg/__init__.py @@ -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: diff --git a/tox.ini b/tox.ini index 105f25e..de83956 100644 --- a/tox.ini +++ b/tox.ini @@ -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]