aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/mesonlib
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-09-01 14:14:29 -0400
committerXavier Claessens <xclaesse@gmail.com>2021-09-02 19:38:29 -0400
commita616a23713dd34638adee29413603b2eeb80456b (patch)
treecb05a5a1f2848a6596d2af307e5e5f698fd535c8 /mesonbuild/mesonlib
parent1dbb6d6b8c83cdad0f478b15395103589cbfb9b3 (diff)
downloadmeson-a616a23713dd34638adee29413603b2eeb80456b.zip
meson-a616a23713dd34638adee29413603b2eeb80456b.tar.gz
meson-a616a23713dd34638adee29413603b2eeb80456b.tar.bz2
OptionKey: Fix ordering
When sorting options we want the same order as they are presented in "meson configure" command.
Diffstat (limited to 'mesonbuild/mesonlib')
-rw-r--r--mesonbuild/mesonlib/universal.py18
1 files changed, 8 insertions, 10 deletions
diff --git a/mesonbuild/mesonlib/universal.py b/mesonbuild/mesonlib/universal.py
index 06b8adf..e4664d5 100644
--- a/mesonbuild/mesonlib/universal.py
+++ b/mesonbuild/mesonlib/universal.py
@@ -1967,15 +1967,15 @@ class OptionOverrideProxy(collections.abc.MutableMapping):
return OptionOverrideProxy(self.overrides.copy(), self.options.copy())
-class OptionType(enum.Enum):
+class OptionType(enum.IntEnum):
"""Enum used to specify what kind of argument a thing is."""
BUILTIN = 0
- BASE = 1
- COMPILER = 2
- PROJECT = 3
- BACKEND = 4
+ BACKEND = 1
+ BASE = 2
+ COMPILER = 3
+ PROJECT = 4
# This is copied from coredata. There is no way to share this, because this
# is used in the OptionKey constructor, and the coredata lists are
@@ -2105,11 +2105,9 @@ class OptionKey:
def __lt__(self, other: object) -> bool:
if isinstance(other, OptionKey):
- return (
- self.name < other.name and
- self.subproject < other.subproject and
- self.machine < other.machine and
- self.lang < other.lang)
+ self_tuple = (self.subproject, self.type, self.lang, self.machine, self.name)
+ other_tuple = (other.subproject, other.type, other.lang, other.machine, other.name)
+ return self_tuple < other_tuple
return NotImplemented
def __str__(self) -> str: