From e3b1eca62528c19962f482813d0713405d4baf07 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 9 Jun 2026 09:16:37 -0700 Subject: [PATCH] environment: Turn on mypy strict optional --- .mypy.ini | 3 +++ mesonbuild/environment.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.mypy.ini b/.mypy.ini index 99d2a3459..08bd76d7f 100644 --- a/.mypy.ini +++ b/.mypy.ini @@ -39,6 +39,9 @@ strict_optional = True [mypy-mesonbuild.envconfig] strict_optional = True +[mypy-mesonbuild.environment] +strict_optional = True + [mypy-mesonbuild.machinefile] strict_optional = True diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index a27ca5a2e..5805346dc 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -111,6 +111,8 @@ class Environment: log_dir = 'meson-logs' info_dir = 'meson-info' + exe_wrapper: ExternalProgram | None + def __init__(self, source_dir: str, build_dir: T.Optional[str], cmd_options: cmdline.SharedCMDOptions) -> None: self.source_dir = source_dir # Do not try to create build directories when build_dir is none. @@ -258,6 +260,7 @@ class Environment: if k.machine is MachineChoice.HOST or self.coredata.optstore.is_per_machine_option(k)} exe_wrapper = self.lookup_binary_entry(MachineChoice.HOST, 'exe_wrapper') + self.exe_wrapper: ExternalProgram | None if exe_wrapper is not None: self.exe_wrapper = ExternalProgram.from_bin_list(self, MachineChoice.HOST, 'exe_wrapper') else: