From e13d92bb6a5a2a1e18b87ce4a88a744361a27952 Mon Sep 17 00:00:00 2001 From: Dylan Baker <dylan@pnwbakers.com> Date: Wed, 8 Dec 2021 09:35:03 -0800 Subject: [PATCH] mesonlib: make get_meson_command return an ImmutableList We really don't want to be mutating global state, so let mypy yell at us when we try. --- mesonbuild/mesonlib/universal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py index f6c7f6446..7699ea446 100644 --- a/mesonbuild/mesonlib/universal.py +++ b/mesonbuild/mesonlib/universal.py @@ -155,7 +155,7 @@ if os.path.basename(sys.executable) == 'meson.exe': python_command = [sys.executable, 'runpython'] else: python_command = [sys.executable] -_meson_command = None +_meson_command: T.Optional['ImmutableListProtocol[str]'] = None class MesonException(Exception): '''Exceptions thrown by Meson''' @@ -230,7 +230,7 @@ def set_meson_command(mainfile: str) -> None: mlog.log(f'meson_command is {_meson_command!r}') -def get_meson_command() -> T.Optional[T.List[str]]: +def get_meson_command() -> T.Optional['ImmutableListProtocol[str]']: return _meson_command