aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-12-03 11:37:52 -0800
committerDylan Baker <dylan@pnwbakers.com>2021-01-04 12:20:40 -0800
commitf9b19e73a5b87a2f3c8506cf19cfd5bbc468e938 (patch)
tree62a822655f89133babd261a18adc40e3cb44a0fe /mesonbuild/environment.py
parentfe973d9fc45581f20fefc41fc0b8eb0066c0129d (diff)
downloadmeson-f9b19e73a5b87a2f3c8506cf19cfd5bbc468e938.zip
meson-f9b19e73a5b87a2f3c8506cf19cfd5bbc468e938.tar.gz
meson-f9b19e73a5b87a2f3c8506cf19cfd5bbc468e938.tar.bz2
move OptionKey to mesonlib
There's starting to be a lot of things including coredata that coredata needs to itself include. putting it in mesonlib makes more sense
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 3120279..3ea078a 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -23,7 +23,7 @@ from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, DLinker, CcrxLin
from . import mesonlib
from .mesonlib import (
MesonException, EnvironmentException, MachineChoice, Popen_safe,
- PerMachineDefaultable, PerThreeMachineDefaultable, split_args, quote_arg
+ PerMachineDefaultable, PerThreeMachineDefaultable, split_args, quote_arg, OptionKey
)
from . import mlog
@@ -605,7 +605,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[coredata.OptionKey, str] = collections.OrderedDict()
+ self.options: T.MutableMapping[OptionKey, str] = collections.OrderedDict()
## Read in native file(s) to override build machine configuration
@@ -655,9 +655,9 @@ class Environment:
# Warn if the user is using two different ways of setting build-type
# options that override each other
- bt = coredata.OptionKey('buildtype')
- db = coredata.OptionKey('debug')
- op = coredata.OptionKey('optimization')
+ bt = OptionKey('buildtype')
+ db = OptionKey('debug')
+ op = OptionKey('optimization')
if bt in self.options and (db in self.options or op in self.options):
mlog.warning('Recommend using either -Dbuildtype or -Doptimization + -Ddebug. '
'Using both is redundant since they override each other. '
@@ -723,7 +723,7 @@ class Environment:
if paths:
mlog.deprecation('The [paths] section is deprecated, use the [built-in options] section instead.')
for k, v in paths.items():
- self.options[coredata.OptionKey.from_string(k).evolve(machine=machine)] = v
+ self.options[OptionKey.from_string(k).evolve(machine=machine)] = v
deprecated_properties = set()
for lang in compilers.all_languages:
deprecated_properties.add(lang + '_args')
@@ -731,7 +731,7 @@ class Environment:
for k, v in properties.properties.copy().items():
if k in deprecated_properties:
mlog.deprecation('{} in the [properties] section of the machine file is deprecated, use the [built-in options] section.'.format(k))
- self.options[coredata.OptionKey.from_string(k).evolve(machine=machine)] = v
+ self.options[OptionKey.from_string(k).evolve(machine=machine)] = v
del properties.properties[k]
for section, values in config.items():
if ':' in section:
@@ -740,12 +740,12 @@ class Environment:
subproject = ''
if section == 'built-in options':
for k, v in values.items():
- key = coredata.OptionKey.from_string(k).evolve(subproject=subproject, machine=machine)
+ key = OptionKey.from_string(k).evolve(subproject=subproject, machine=machine)
self.options[key] = v
elif section == 'project options':
for k, v in values.items():
# Project options are always for the machine machine
- key = coredata.OptionKey.from_string(k).evolve(subproject=subproject)
+ key = OptionKey.from_string(k).evolve(subproject=subproject)
self.options[key] = v
def set_default_options_from_env(self) -> None:
@@ -763,7 +763,7 @@ class Environment:
# FIXME: We should remember if we took the value from env to warn
# if it changes on future invocations.
if self.first_invocation:
- key = coredata.OptionKey(keyname, machine=for_machine)
+ key = OptionKey(keyname, machine=for_machine)
self.options.setdefault(key, p_list)
def create_new_coredata(self, options: 'argparse.Namespace') -> None:
@@ -938,7 +938,7 @@ class Environment:
elif isinstance(comp_class.LINKER_PREFIX, list):
check_args = comp_class.LINKER_PREFIX + ['/logo'] + comp_class.LINKER_PREFIX + ['--version']
- check_args += self.coredata.compiler_options[coredata.OptionKey('args', lang=comp_class.language, machine=for_machine)].value
+ check_args += self.coredata.compiler_options[OptionKey('args', lang=comp_class.language, machine=for_machine)].value
override = [] # type: T.List[str]
value = self.lookup_binary_entry(for_machine, comp_class.language + '_ld')
@@ -1004,7 +1004,7 @@ class Environment:
"""
self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
extra_args = extra_args or []
- extra_args += self.coredata.compiler_options[coredata.OptionKey('args', lang=comp_class.language, machine=for_machine)].value
+ extra_args += self.coredata.compiler_options[OptionKey('args', lang=comp_class.language, machine=for_machine)].value
if isinstance(comp_class.LINKER_PREFIX, str):
check_args = [comp_class.LINKER_PREFIX + '--version'] + extra_args