aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2018-11-28 01:48:57 -0500
committerJohn Ericson <John.Ericson@Obsidian.Systems>2019-01-02 16:22:47 -0500
commite147054d6f8b78b306125fd785603ca0519fdfc1 (patch)
treecde01f813bff018f3df615bff7276b8fa9d88b06
parentedb3585b65f6a1f36c3b4d39d92e049c49c8837e (diff)
downloadmeson-e147054d6f8b78b306125fd785603ca0519fdfc1.zip
meson-e147054d6f8b78b306125fd785603ca0519fdfc1.tar.gz
meson-e147054d6f8b78b306125fd785603ca0519fdfc1.tar.bz2
Get rid of `ConfigData`
-rw-r--r--mesonbuild/coredata.py36
-rw-r--r--mesonbuild/environment.py11
2 files changed, 7 insertions, 40 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 8ada86a..b650f78 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -231,42 +231,6 @@ def load_configs(filenames):
return config
-def _get_section(config, section):
- if config.has_section(section):
- final = {}
- for k, v in config.items(section):
- # Windows paths...
- v = v.replace('\\', '\\\\')
- try:
- final[k] = ast.literal_eval(v)
- except SyntaxError:
- raise MesonException(
- 'Malformed value in native file variable: {}'.format(v))
- return final
- return {}
-
-
-class ConfigData:
-
- """Contains configuration information provided by the user for the build."""
-
- def __init__(self, config=None):
- if config:
- self.binaries = _get_section(config, 'binaries')
- # global is a keyword and globals is a builtin, rather than mangle it,
- # use a similar word
- self.universal = _get_section(config, 'globals')
- self.subprojects = {s: _get_section(config, s) for s in config.sections()
- if s not in {'binaries', 'globals'}}
- else:
- self.binaries = {}
- self.universal = {}
- self.subprojects = {}
-
- def get_binaries(self, name):
- return self.binaries.get(name, None)
-
-
# This class contains all data that must persist over multiple
# invocations of Meson. It is roughly the same thing as
# cmakecache.
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index b48868c..b10f826 100644
--- a/mesonbuild/environment.py
+++ b/mesonbuild/environment.py
@@ -346,16 +346,17 @@ class Environment:
# Similar to coredata.compilers and build.compilers, but lower level in
# that there is no meta data, only names/paths.
self.binaries = 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())
if self.coredata.config_files is not None:
- config_info = coredata.ConfigData(
+ config = MesonConfigFile.from_config_parser(
coredata.load_configs(self.coredata.config_files))
- else:
- config_info = coredata.ConfigData()
- self.binaries.build = BinaryTable(config_info.binaries)
+ self.binaries.build = BinaryTable(config.get('binaries', {}))
if self.coredata.cross_file is not None:
config = MesonConfigFile.parse_datafile(self.coredata.cross_file)
@@ -1168,6 +1169,8 @@ class MesonConfigFile:
section = {}
for entry in parser[s]:
value = parser[s][entry]
+ # Windows paths...
+ value = value.replace('\\', '\\\\')
if ' ' in entry or '\t' in entry or "'" in entry or '"' in entry:
raise EnvironmentException('Malformed variable name %s in cross file..' % entry)
try: