From 582d499e32e75beb5428366d48504cb207cbc7ae Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 17 Feb 2026 21:07:27 +0900 Subject: [PATCH 1/6] meson: ukify unconditionally requires pefile module Follow-up for 3fc5eed47091363247012454df458e1a3303bf12. --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index ee96fcb21f..0361bc5904 100644 --- a/meson.build +++ b/meson.build @@ -1898,7 +1898,7 @@ endif pefile = pymod.find_installation('python3', required: false, modules : ['pefile']) -want_ukify = get_option('ukify').require(python_39 and (want_tests != 'true' or pefile.found()), error_message : 'Python >= 3.9 and pefile required').allowed() +want_ukify = get_option('ukify').require(python_39 and pefile.found(), error_message : 'Python >= 3.9 and pefile required').allowed() conf.set10('ENABLE_UKIFY', want_ukify) ##################################################################### From 761f1ef2f36f224881080337f30950e9d3bd2c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Behrmann?= Date: Tue, 17 Feb 2026 10:20:05 +0100 Subject: [PATCH 2/6] Bump minimum version of python to 3.9 This was announced in fd8c62075197e4f4702bb6e4537116a64cb539b7 and every still-supported distributo release provides at least 3.9, as tracked by #38608. --- .github/workflows/build-test.yml | 2 +- README | 2 +- meson.build | 8 ++++---- ruff.toml | 7 +------ test/test-udev.py | 2 +- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 06bff4bc74..8c70f656eb 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -47,7 +47,7 @@ jobs: # older glibc - env: { COMPILER: "gcc", COMPILER_VERSION: "12", LINKER: "bfd", CUSTOM_PYTHON: "1" } runner: [ ubuntu-22.04 ] - python-version: '3.7' + python-version: '3.9' env: ${{ matrix.env }} steps: - name: Repository checkout diff --git a/README b/README index 9158cb1283..d85295b10e 100644 --- a/README +++ b/README @@ -247,7 +247,7 @@ REQUIREMENTS: gperf docbook-xsl (optional, required for documentation) xsltproc (optional, required for documentation) - python >= 3.7 (required by meson too, >= 3.9 is required for ukify) + python >= 3.9 python-jinja2 python-pefile (optional, required for ukify) python-lxml (optional, required to build the indices) diff --git a/meson.build b/meson.build index 0361bc5904..bf419b7f60 100644 --- a/meson.build +++ b/meson.build @@ -1695,7 +1695,9 @@ conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', want_slow_tests) pymod = import('python') python = pymod.find_installation('python3', required : true, modules : ['jinja2']) -python_39 = python.language_version().version_compare('>=3.9') +if not python.language_version().version_compare('>=3.9') + error('Python >= 3.9 is required') +endif ##################################################################### @@ -1896,9 +1898,7 @@ if have and efi_arch == 'x64' and cc.links(''' efi_cpu_family_alt = 'x86' endif -pefile = pymod.find_installation('python3', required: false, modules : ['pefile']) - -want_ukify = get_option('ukify').require(python_39 and pefile.found(), error_message : 'Python >= 3.9 and pefile required').allowed() +want_ukify = pymod.find_installation('python3', required: get_option('ukify'), modules : ['pefile']).found() conf.set10('ENABLE_UKIFY', want_ukify) ##################################################################### diff --git a/ruff.toml b/ruff.toml index 8ace55fb96..6c0ec6ceb8 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,11 +1,6 @@ -target-version = "py37" +target-version = "py39" line-length = 109 lint.select = ["E", "F", "I", "UP"] [format] quote-style = "single" - -[per-file-target-version] -"src/ukify/*.py" = "py39" -"test/**/integration-test-wrapper.py" = "py39" -"test/test-udev.py" = "py39" diff --git a/test/test-udev.py b/test/test-udev.py index 49695ef739..20b55de7d6 100755 --- a/test/test-udev.py +++ b/test/test-udev.py @@ -17,6 +17,7 @@ # removes the device node. After creation and removal the result is checked # against the expected value and the result is printed. +import dataclasses import functools import os import pwd, grp @@ -30,7 +31,6 @@ from pathlib import Path from typing import Callable, Optional try: - import dataclasses # requires Python >= 3.7 import pytest except ImportError as e: print(str(e), file=sys.stderr) From 3aaa9d988218bf44a9c92791aa8d3cb1d796124d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 17 Feb 2026 20:31:10 +0900 Subject: [PATCH 3/6] Revert "meson: fix compatibility with Python 3.7" This reverts commit 2793d6acf063ae8fe506a1684e5a24ce83267e6d. Now we require Python 3.9 or newer. --- src/basic/filesystem-sets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/basic/filesystem-sets.py b/src/basic/filesystem-sets.py index 09fcc0347a..c622b53978 100755 --- a/src/basic/filesystem-sets.py +++ b/src/basic/filesystem-sets.py @@ -308,7 +308,7 @@ def generate_fs_in_group(): print(' switch (fs_group) {') for name, _, *filesystems in FILESYSTEM_SETS: - magics = sorted(set(sum((NAME_TO_MAGIC[fs] for fs in filesystems), []))) + magics = sorted(set(sum((NAME_TO_MAGIC[fs] for fs in filesystems), start=[]))) enum = 'FILESYSTEM_SET_' + name[1:].upper().replace('-', '_') print(f' case {enum}:') opts = '\n || '.join(f'F_TYPE_EQUAL(st->f_type, {magic})' @@ -355,7 +355,7 @@ def magic_defines(): def check(): kernel_magics = set(magic_defines()) - our_magics = set(sum(NAME_TO_MAGIC.values(), [])) + our_magics = set(sum(NAME_TO_MAGIC.values(), start=[])) extra = kernel_magics - our_magics if extra: sys.exit(f"kernel knows additional filesystem magics: {', '.join(sorted(extra))}") From 7ff27c8012c214c5d02feb20a5eafafbefaf1c1d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 17 Feb 2026 20:33:54 +0900 Subject: [PATCH 4/6] Revert "generate-bpf-delegate-configs: fix compatibility with Python 3.7" This reverts commit dee77ac201741709b2323cae73aeeaff60fd8521. Now we require Python 3.9 or newer. --- src/core/generate-bpf-delegate-configs.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/core/generate-bpf-delegate-configs.py b/src/core/generate-bpf-delegate-configs.py index 4444282b4b..200c913b8a 100755 --- a/src/core/generate-bpf-delegate-configs.py +++ b/src/core/generate-bpf-delegate-configs.py @@ -7,7 +7,6 @@ import re import sys -import typing def print_usage_and_exit() -> None: @@ -27,7 +26,7 @@ if output not in ['code', 'doc']: with open(header) as file: inEnum = False - enumValues: typing.List[str] = [] + enumValues: list[str] = [] enumName = '' if output == 'doc': @@ -68,12 +67,10 @@ with open(header) as file: match = re.fullmatch(r'(\w+)\b,', line) if match and len(match.groups()) > 0 and not match[1].startswith('__'): enumValues.append(match[1]) - else: - match = re.match(r'^\s*enum\s+bpf_(cmd|map_type|prog_type|attach_type)+\s*{', line) - if match: - # Start of a new enum - inEnum = True - enumName = 'bpf_delegate_' + match[1] + elif match := re.match(r'^\s*enum\s+bpf_(cmd|map_type|prog_type|attach_type)+\s*{', line): + # Start of a new enum + inEnum = True + enumName = 'bpf_delegate_' + match[1] if output == 'doc': print('') From 08719d0e787b39fd340e88c49578ca764b71f774 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 17 Feb 2026 20:40:24 +0900 Subject: [PATCH 5/6] Revert "tools: make update-dbus-docs compatible with Python 3.7" This reverts commit 668b3a42fe9e250912bd3efa4460ed691452d9bf. Now we require Python 3.9 or newer. --- tools/update-dbus-docs.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/tools/update-dbus-docs.py b/tools/update-dbus-docs.py index 8e4ab62569..99c3db5744 100755 --- a/tools/update-dbus-docs.py +++ b/tools/update-dbus-docs.py @@ -19,11 +19,6 @@ try: except ImportError as e: shlex_join = e -try: - from shlex import quote as shlex_quote -except ImportError as e: - shlex_quote = e - class NoCommand(Exception): pass @@ -214,10 +209,7 @@ def subst_output(document, programlisting, stats, missing_version): interface = programlisting.get('interface') argv = [f'{arguments.build_dir}/{executable}', f'--bus-introspect={interface}'] - if isinstance(shlex_join, Exception): - print(f'COMMAND: {" ".join(shlex_quote(arg) for arg in argv)}') - else: - print(f'COMMAND: {shlex_join(argv)}') + print(f'COMMAND: {shlex_join(argv)}') try: out = subprocess.check_output(argv, universal_newlines=True) @@ -326,7 +318,7 @@ def main(): global arguments arguments = parse_args() - for item in (etree, shlex_quote): + for item in (etree, shlex_join): if isinstance(item, Exception): print(item, file=sys.stderr) sys.exit(77 if arguments.test else 1) @@ -348,7 +340,7 @@ def main(): # Let's print all statistics at the end mlen = max(len(page) for page in stats) - total = sum((item['stats'] for item in stats.values()), collections.Counter()) + total = sum((item['stats'] for item in stats.values()), start=collections.Counter()) total = 'total', { "stats" : total, "modified" : False } modified = [] classification = 'OUTDATED' if arguments.test else 'MODIFIED' From ef6c8c79dc9a3ff91c4f3003060bd7d31d4386f9 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 17 Feb 2026 20:40:55 +0900 Subject: [PATCH 6/6] Revert "check-os-release.py compatible with Python < 3.8" This reverts commit ce0a056abc41168e1b45537505ca9f65bf6f5c30. --- man/check-os-release.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/man/check-os-release.py b/man/check-os-release.py index 19b193ec76..f0a64f3496 100755 --- a/man/check-os-release.py +++ b/man/check-os-release.py @@ -17,8 +17,7 @@ def read_os_release(): line = line.rstrip() if not line or line.startswith('#'): continue - m = re.match(r'([A-Z][A-Z_0-9]+)=(.*)', line) - if m: + if m := re.match(r'([A-Z][A-Z_0-9]+)=(.*)', line): name, val = m.groups() if val and val[0] in '"\'': val = ast.literal_eval(val)