OptionKey: Fix ordering
When sorting options we want the same order as they are presented in
"meson configure" command.
@@ -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:
