aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2019-02-26 00:55:43 -0500
committerDylan Baker <dylan@pnwbakers.com>2019-02-27 13:10:16 -0800
commitc2db7a9ceed3286683967768e6fcc1c170c24c42 (patch)
tree21fcc3ca3be725d4208f3b50a81b06e82caa48be /mesonbuild/environment.py
parent2622e9ec323126edadfcd7017e6ee63c026abb9c (diff)
downloadmeson-c2db7a9ceed3286683967768e6fcc1c170c24c42.zip
meson-c2db7a9ceed3286683967768e6fcc1c170c24c42.tar.gz
meson-c2db7a9ceed3286683967768e6fcc1c170c24c42.tar.bz2
Sync up initialization logic with Properties and BinaryTable
1. They (and the others) all use PerMachineDefaultable. It's not the best class, but consistency come first. (It and all of them can be improved accross the board later.) 2. They use `None` as the default argument so as not to mutate what's effectively a global variables. (Thanks @dcbaker!) 3. They have a `fallback` field to centralize authority on when environment variables should be consulted.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r--mesonbuild/environment.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index 9760b08..3bfdfd7 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -375,12 +375,13 @@ class Environment:
# that there is no meta data, only names/paths.
self.binaries = PerMachineDefaultable()
+ # Misc other properties about each machine.
+ self.properties = PerMachineDefaultable()
+
# Just uses hard-coded defaults and environment variables. Might be
# overwritten by a native file.
- self.binaries.build = BinaryTable({})
-
- # Misc other properties about each machine.
- self.properties = PerMachine(Properties(), Properties(), Properties())
+ self.binaries.build = BinaryTable()
+ self.properties.build = Properties()
# Store paths for native and cross build files. There is no target
# machine information here because nothing is installed for the target
@@ -395,7 +396,7 @@ class Environment:
if self.coredata.cross_file is not None:
config = MesonConfigFile.parse_datafile(self.coredata.cross_file)
- self.properties.host.properties = config.get('properties', {})
+ self.properties.host = Properties(config.get('properties', {}), False)
self.binaries.host = BinaryTable(config.get('binaries', {}), False)
if 'host_machine' in config:
self.machines.host = MachineInfo.from_literal(config['host_machine'])
@@ -405,6 +406,7 @@ class Environment:
self.machines.default_missing()
self.binaries.default_missing()
+ self.properties.default_missing()
self.paths.default_missing()
exe_wrapper = self.binaries.host.lookup_entry('exe_wrapper')