From: Jörg Behrmann Date: Tue, 17 Feb 2026 09:20:05 +0000 (+0100) Subject: Bump minimum version of python to 3.9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=761f1ef2f36f224881080337f30950e9d3bd2c0d;p=thirdparty%2Fsystemd.git 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. --- diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 06bff4bc74d..8c70f656eb9 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 9158cb12835..d85295b10e2 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 0361bc5904a..bf419b7f60f 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 8ace55fb967..6c0ec6ceb84 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 49695ef7394..20b55de7d67 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)