diff options
| author | Dylan Baker <dylan@pnwbakers.com> | 2024-10-01 10:41:59 -0700 |
|---|---|---|
| committer | Jussi Pakkanen <jpakkane@gmail.com> | 2025-03-01 13:30:06 +0200 |
| commit | f0795e14c55dfbad2291136090ee964cce2c38ed (patch) | |
| tree | e9c977aaee1b004867034a481d66206230891399 /mesonbuild/environment.py | |
| parent | dfa118547247dc862310052f75fcdbc020089c24 (diff) | |
| download | meson-f0795e14c55dfbad2291136090ee964cce2c38ed.tar.gz | |
environment: make fully type safe
This as much as anything is to stop lying to envconfig about the
potential types it will be given.
Diffstat (limited to 'mesonbuild/environment.py')
| -rw-r--r-- | mesonbuild/environment.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index d124a608b..76eb5617b 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -41,10 +41,9 @@ from functools import lru_cache from mesonbuild import envconfig if T.TYPE_CHECKING: - from configparser import ConfigParser - from .compilers import Compiler from .compilers.mixins.visualstudio import VisualStudioLikeCompiler + from .options import ElementaryOptionValues from .wrap.wrap import Resolver from . import cargo @@ -633,7 +632,7 @@ class Environment: # # Note that order matters because of 'buildtype', if it is after # 'optimization' and 'debug' keys, it override them. - self.options: T.MutableMapping[OptionKey, T.Union[str, T.List[str]]] = collections.OrderedDict() + self.options: T.MutableMapping[OptionKey, ElementaryOptionValues] = collections.OrderedDict() self.machinestore = machinefile.MachineFileStore(self.coredata.config_files, self.coredata.cross_files, self.source_dir) @@ -701,7 +700,7 @@ class Environment: # Store a global state of Cargo dependencies self.cargo: T.Optional[cargo.Interpreter] = None - def mfilestr2key(self, machine_file_string: str, section_subproject: str, machine: MachineChoice): + def mfilestr2key(self, machine_file_string: str, section_subproject: str, machine: MachineChoice) -> OptionKey: key = OptionKey.from_string(machine_file_string) assert key.machine == MachineChoice.HOST if key.subproject: @@ -712,7 +711,8 @@ class Environment: return key.evolve(machine=machine) return key - def _load_machine_file_options(self, config: 'ConfigParser', properties: Properties, machine: MachineChoice) -> None: + def _load_machine_file_options(self, config: T.Mapping[str, T.Mapping[str, ElementaryOptionValues]], + properties: Properties, machine: MachineChoice) -> None: """Read the contents of a Machine file and put it in the options store.""" # Look for any options in the deprecated paths section, warn about |
