diff options
author | John Ericson <git@JohnEricson.me> | 2018-12-12 00:19:03 -0500 |
---|---|---|
committer | John Ericson <git@JohnEricson.me> | 2019-02-02 13:59:14 -0500 |
commit | 19f81d3e33c70c9c902dabaad732e5d33bf05bd4 (patch) | |
tree | f86664395d7233bbba9e3c129c81c7056c6fa98b /mesonbuild/environment.py | |
parent | 6dbe33d949237411b1291c30f5383885befb3554 (diff) | |
download | meson-19f81d3e33c70c9c902dabaad732e5d33bf05bd4.zip meson-19f81d3e33c70c9c902dabaad732e5d33bf05bd4.tar.gz meson-19f81d3e33c70c9c902dabaad732e5d33bf05bd4.tar.bz2 |
Never access environment.properties downstream
Instead use coredata.compiler_options.<machine>. This brings the cross
and native code paths closer together, since both now use that.
Command line options are interpreted just as before, for backwards
compatibility. This does introduce some funny conditionals. In the
future, I'd like to change the interpretation of command line options so
- The logic is cross-agnostic, i.e. there are no conditions affected by
`is_cross_build()`.
- Compiler args for both the build and host machines can always be
controlled by the command line.
- Compiler args for both machines can always be controlled separately.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 3fb93ca..7bf149f 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import configparser, os, platform, re, sys, shlex, shutil, subprocess +import configparser, os, platform, re, sys, shlex, shutil, subprocess, typing from . import coredata from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, DLinker, CcrxLinker @@ -1086,7 +1086,7 @@ class Environment: def detect_compilers(self, lang: str, need_cross_compiler: bool): (comp, cross_comp) = self.compilers_from_language(lang, need_cross_compiler) if comp is not None: - self.coredata.process_new_compilers(lang, comp, cross_comp, self.cmd_line_options) + self.coredata.process_new_compilers(lang, comp, cross_comp, self) return comp, cross_comp def detect_static_linker(self, compiler): @@ -1268,14 +1268,10 @@ class MesonConfigFile: return out class Properties: - def __init__(self): - self.properties = {} - - def get_external_args(self, language): - return mesonlib.stringlistify(self.properties.get(language + '_args', [])) - - def get_external_link_args(self, language): - return mesonlib.stringlistify(self.properties.get(language + '_link_args', [])) + def __init__( + self, + properties: typing.Optional[typing.Dict[str, typing.Union[str, typing.List[str]]]] = None): + self.properties = properties or {} def has_stdlib(self, language): return language + '_stdlib' in self.properties @@ -1289,6 +1285,11 @@ class Properties: def get_sys_root(self): return self.properties.get('sys_root', None) + def __eq__(self, other): + if isinstance(other, type(self)): + return self.properties == other.properties + return NotImplemented + # TODO consider removing so Properties is less freeform def __getitem__(self, key): return self.properties[key] |