aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-03-07 00:17:06 +0530
committerXavier Claessens <xclaesse@gmail.com>2020-03-11 07:11:59 -0400
commitbc135f6c4dd56c925438d9c84f3bb6794f7ecaa3 (patch)
tree9e7eeb4ef7f474cdea458d5a0f23e97daaf327c7 /mesonbuild
parent1bd1f9808650ab640b189f96ce8e13aa4b39e74f (diff)
downloadmeson-bc135f6c4dd56c925438d9c84f3bb6794f7ecaa3.zip
meson-bc135f6c4dd56c925438d9c84f3bb6794f7ecaa3.tar.gz
meson-bc135f6c4dd56c925438d9c84f3bb6794f7ecaa3.tar.bz2
coredata: Convert all option parsing to OrderedDict()
This ensures that options are always parsed in the order in which they were specified on the command-line, even with Python 3.5, and non-CPython implementations compatible with CPython 3.5 and 3.6. Closes https://github.com/mesonbuild/meson/issues/6742
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/coredata.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py
index 521d149..fdd8cab 100644
--- a/mesonbuild/coredata.py
+++ b/mesonbuild/coredata.py
@@ -668,7 +668,7 @@ class CoreData:
return len(self.cross_files) > 0
def strip_build_option_names(self, options):
- res = {}
+ res = OrderedDict()
for k, v in options.items():
if k.startswith('build.'):
k = k.split('.', 1)[1]
@@ -741,7 +741,7 @@ class CoreData:
# Language and backend specific options will be set later when adding
# languages and setting the backend (builtin options must be set first
# to know which backend we'll use).
- options = {}
+ options = OrderedDict()
# Some options default to environment variables if they are
# unset, set those now. These will either be overwritten
@@ -861,7 +861,7 @@ def write_cmd_line_file(build_dir, options):
filename = get_cmd_line_file(build_dir)
config = CmdLineFileParser()
- properties = {}
+ properties = OrderedDict()
if options.cross_file:
properties['cross_file'] = options.cross_file
if options.native_file:
@@ -941,7 +941,7 @@ def register_builtin_arguments(parser):
help='Set the value of an option, can be used several times to set multiple options.')
def create_options_dict(options):
- result = {}
+ result = OrderedDict()
for o in options:
try:
(key, value) = o.split('=', 1)
@@ -1026,7 +1026,7 @@ class BuiltinOption(T.Generic[_T, _U]):
return self.default
def add_to_argparse(self, name: str, parser: argparse.ArgumentParser, prefix: str, help_suffix: str) -> None:
- kwargs = {}
+ kwargs = OrderedDict()
c = self._argparse_choices()
b = self._argparse_action()