Drop Python < 3.10 support

This commit is contained in:
Dylan Baker
2025-12-19 08:49:24 -08:00
parent aee0e302d0
commit 30599dfb98
13 changed files with 29 additions and 33 deletions

View File

@@ -12,7 +12,7 @@ build system.
#### Dependencies
- [Python](https://python.org) (version 3.7 or newer)
- [Python](https://python.org) (version 3.10 or newer)
- [Ninja](https://ninja-build.org) (version 1.8.2 or newer)
Latest Meson version supporting previous Python versions:

View File

@@ -20,7 +20,7 @@ if ($env:arch -eq 'x64') {
# Rust puts its shared stdlib in a secret place, but it is needed to run tests.
$env:Path += ";$HOME/.rustup/toolchains/stable-i686-pc-windows-msvc/bin"
# Need 32-bit Python for tests that need the Python dependency
$env:Path = "C:\hostedtoolcache\windows\Python\3.7.9\x86;C:\hostedtoolcache\windows\Python\3.7.9\x86\Scripts;$env:Path"
$env:Path = "C:\hostedtoolcache\windows\Python\3.10.19\x86;C:\hostedtoolcache\windows\Python\3.10.19\x86\Scripts;$env:Path"
}
# Set the CI env var for the meson test framework
@@ -92,7 +92,7 @@ python --version
# Needed for running unit tests in parallel.
echo ""
python -m pip --disable-pip-version-check install --upgrade pefile pytest-xdist pytest-subtests fastjsonschema
python -m pip --disable-pip-version-check install --upgrade pefile pytest-xdist pytest-subtests fastjsonschema
# Needed for running the Cython tests
python -m pip --disable-pip-version-check install cython

View File

@@ -1,6 +1,6 @@
# Getting Meson
Meson is implemented in Python 3, and requires 3.7 or newer. If your
Meson is implemented in Python 3, and requires 3.10 or newer. If your
operating system provides a package manager, you should install it
with that. For platforms that don't have a package manager, you need
to download it from [Python's home page]. See below for
@@ -14,7 +14,7 @@ itself without doing anything special.
On Windows, if you did not install Python with the installer options
that make Python scripts executable, you will have to run `python
/path/to/meson.py`, where `python` is Python 3.7 or newer.
/path/to/meson.py`, where `python` is Python 3.10 or newer.
The newest development code can be obtained directly from [Git], and
we strive to ensure that it will always be working and usable. All

View File

@@ -1,6 +1,6 @@
# Obtendo o Meson
Meson é implementado em Python 3, e requer a versão 3.7 ou mais nova.
Meson é implementado em Python 3, e requer a versão 3.10 ou mais nova.
se o seu sistema operacional provê um gerenciador de pacotes, você deve
instalar o Meson com ele. Para plataformas que não tem um gerenciador de
pacotes, você precisa baixa-lo da [página inicial do Python]. Veja abaixo
@@ -14,7 +14,7 @@ do git sem fazer nada de especial.
No Windows, se você não instalar o Python com a opção do instalador que fazem
os *scripts* Python executáveis, você vai ter que executar `python
/path/to/meson.py`, onde `python` é o Python 3.7 ou mais novo.
/path/to/meson.py`, onde `python` é o Python 3.10 ou mais novo.
O código de desenvolvimento mais recente pode ser obtido diretamente do [Git],
e nós lutamos para garatir que ele vai estar sempre funcionando e usável. Todos

View File

@@ -1,6 +1,6 @@
# 获取Meson
Meson基于Python3运行要求Python版本3.7以上。 如果你的操作系统提供包管理器, 你应该用包管理器安装python如果没有包管理器你应该在[Python主页]下载合适的Python3。相关请参阅[特殊平台的安装特例](#特殊平台的安装特例).
Meson基于Python3运行要求Python版本3.10以上。 如果你的操作系统提供包管理器, 你应该用包管理器安装python如果没有包管理器你应该在[Python主页]下载合适的Python3。相关请参阅[特殊平台的安装特例](#特殊平台的安装特例).
## 下载Meson

View File

@@ -5,8 +5,8 @@ description: |
See [Cross-compilation](Cross-compilation.md).
Currently, these values are populated using
[`platform.system()`](https://docs.python.org/3.7/library/platform.html#platform.system) and
[`platform.machine()`](https://docs.python.org/3.7/library/platform.html#platform.machine).
[`platform.system()`](https://docs.python.org/3.10/library/platform.html#platform.system) and
[`platform.machine()`](https://docs.python.org/3.10/library/platform.html#platform.machine).
If you think the returned values for any of these are incorrect for
your system or CPU, or if your OS is not in the linked table, please
[file a bug](https://github.com/mesonbuild/meson/issues/new) report

View File

@@ -7,8 +7,8 @@ import sys
# Check python version before importing anything else, we might have an older
# Python that would error on f-string syntax for example.
if sys.version_info < (3, 7):
print('Meson works correctly only with python 3.7+.')
if sys.version_info < (3, 10):
print('Meson works correctly only with python 3.10+.')
print('You have python {}.'.format(sys.version))
print('Please update your environment')
sys.exit(1)

View File

@@ -6,7 +6,6 @@ from __future__ import annotations
import importlib.resources
from pathlib import PurePosixPath, Path
import sys
import typing as T
if T.TYPE_CHECKING:
@@ -25,16 +24,15 @@ class DataFile:
path.write_text(data, encoding='utf-8')
def write_to_private(self, env: 'Environment') -> Path:
if sys.version_info >= (3, 9):
try:
# The issue that mypy/pyright see here is caused by a bug in typeshed:
# https://github.com/python/typeshed/pull/15108
resource = importlib.resources.files('mesonbuild') / self.path # type: ignore[operator]
if isinstance(resource, Path):
return resource
except AttributeError:
# fall through to python 3.7 compatible code
pass
try:
# The issue that mypy/pyright see here is caused by a bug in typeshed:
# https://github.com/python/typeshed/pull/15108
resource = importlib.resources.files('mesonbuild') / self.path # type: ignore[operator]
if isinstance(resource, Path):
return resource
except AttributeError:
# fall through to zipapp compatible code
pass
out_file = Path(env.scratch_dir) / 'data' / self.path.name
out_file.parent.mkdir(exist_ok=True)

View File

@@ -39,7 +39,7 @@ if T.TYPE_CHECKING:
try:
from typing import Protocol
except AttributeError:
from typing_extensions import Protocol # type: ignore
from typing_extensions import Protocol
class ArgumentType(Protocol):
"""Typing information for the object returned by argparse."""
@@ -165,7 +165,7 @@ def set_chown(path: str, user: T.Union[str, int, None] = None,
if sys.version_info >= (3, 13):
# pylint: disable=unexpected-keyword-arg
# cannot handle sys.version_info, https://github.com/pylint-dev/pylint/issues/9622
shutil.chown(path, user, group, dir_fd=dir_fd, follow_symlinks=follow_symlinks) # type: ignore[call-overload]
shutil.chown(path, user, group, dir_fd=dir_fd, follow_symlinks=follow_symlinks)
else:
real_os_chown = os.chown

View File

@@ -374,7 +374,7 @@ class DependenciesHelper:
# pylance/pyright gets this right, but for mypy we have to ignore the
# error
@T.overload
def _fn(xs: T.List[str], libs: bool = False) -> T.List[str]: ... # type: ignore
def _fn(xs: T.List[str], libs: bool = False) -> T.List[str]: ...
@T.overload
def _fn(xs: T.List[LIBS], libs: bool = False) -> T.List[LIBS]: ...

View File

@@ -157,7 +157,7 @@ def main() -> int:
print('Running mypy (this can take some time) ...')
if opts.allver:
versions = ['default'] + [f'3.{minor}' for minor in range(7, sys.version_info[1])]
versions = ['default'] + [f'3.{minor}' for minor in range(10, sys.version_info[1])]
else:
versions = ['default']

View File

@@ -25,19 +25,17 @@ classifiers =
Operating System :: POSIX :: BSD
Operating System :: POSIX :: Linux
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.13
Programming Language :: Python :: 3.14
Topic :: Software Development :: Build Tools
long_description = Meson is a cross-platform build system designed to be both as fast and as user friendly as possible. It supports many languages and compilers, including GCC, Clang, PGI, Intel, and Visual Studio. Its build definitions are written in a simple non-Turing complete DSL.
[options]
packages = find:
python_requires = >= 3.7
python_requires = >= 3.10
[options.entry_points]
console_scripts =

View File

@@ -5,9 +5,9 @@
import os, sys
if sys.version_info < (3, 7):
if sys.version_info < (3, 10):
raise SystemExit('ERROR: Tried to install Meson with an unsupported Python version: \n{}'
'\nMeson requires Python 3.7.0 or greater'.format(sys.version))
'\nMeson requires Python 3.10.0 or greater'.format(sys.version))
from setuptools import setup