Allow suse_py311 to be selected as template

Change-Id: Ia4705adff71255974bf1b5da280256611b62bfee
This commit is contained in:
Dirk Müller 2024-01-07 14:44:35 +01:00
parent e1f682cd17
commit 6d55b2f165
No known key found for this signature in database
2 changed files with 9 additions and 9 deletions

View File

@ -90,18 +90,18 @@ def _get_default_distro():
if not distname and 'Linux' in platform.system(): if not distname and 'Linux' in platform.system():
try: try:
with open('/etc/os-release', 'r') as lsb_release: with open('/etc/os-release', 'r') as lsb_release:
for l in lsb_release: for line in lsb_release:
if l.startswith('ID_LIKE='): if line.startswith('ID_LIKE='):
distname = l.partition('=')[2].strip( distname = line.partition('=')[2].strip(
string.punctuation + string.whitespace) string.punctuation + string.whitespace)
break break
# Later Fedora versions (e.g. Fedora 32) do not include ID_LIKE # Later Fedora versions (e.g. Fedora 32) do not include ID_LIKE
# in /etc/os-release, so we need to rely on ID # in /etc/os-release, so we need to rely on ID
if not distname: if not distname:
with open('/etc/os-release', 'r') as lsb_release: with open('/etc/os-release', 'r') as lsb_release:
for l in lsb_release: for line in lsb_release:
if l.startswith('ID='): if line.startswith('ID='):
distname = l.partition('=')[2].strip( distname = line.partition('=')[2].strip(
string.punctuation + string.whitespace) string.punctuation + string.whitespace)
break break
except OSError: except OSError:
@ -172,7 +172,7 @@ def process_args():
"default: autodetect") "default: autodetect")
parser.add_argument("--spec-style", help="distro style you want to use. " parser.add_argument("--spec-style", help="distro style you want to use. "
"default: %s" % (distro), default=distro, "default: %s" % (distro), default=distro,
choices=['suse', 'suse_py39', 'fedora']) choices=['suse', 'suse_py39', 'suse_py311', 'fedora'])
parser.add_argument("--skip-pyversion", parser.add_argument("--skip-pyversion",
help='Skip requirements for this pyversion', help='Skip requirements for this pyversion',
default=_get_default_pyskips(distro), default=_get_default_pyskips(distro),

View File

@ -20,11 +20,11 @@ commands = stestr run {posargs}
[testenv:pep8] [testenv:pep8]
deps = {[testenv]deps} deps = {[testenv]deps}
flake8<3.8.0,>=3.7.0 flake8<7.1.0,>=7.0.0
bandit>=1.1.0 bandit>=1.1.0
commands = commands =
flake8 flake8
bandit -r -s B701 renderspec -x tests bandit -r -s B701,B202 renderspec -x tests
[testenv:venv] [testenv:venv]
commands = {posargs} commands = {posargs}