environment: Turn on mypy strict optional

This commit is contained in:
Dylan Baker
2026-06-09 09:16:37 -07:00
committed by Paolo Bonzini
parent 91fd982c7f
commit e3b1eca625
2 changed files with 6 additions and 0 deletions

View File

@@ -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

View File

@@ -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: