qubes: unify property ordering

We already have property ordering defined in property_list(), lets move
it to proper place: property.__lt__.
This commit is contained in:
Marek Marczykowski-Górecki 2017-02-23 22:30:01 +01:00
parent 9ace4e66f1
commit 5e43d26abd
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724

View File

@ -301,9 +301,9 @@ class property(object): # pylint: disable=redefined-builtin,invalid-name
def __lt__(self, other): def __lt__(self, other):
if isinstance(other, property): if isinstance(other, property):
return self.__name__ < other.__name__ return (self.load_stage, self.order, self.__name__) <\
else: (other.load_stage, other.order, other.__name__)
return self < other return NotImplemented
def __eq__(self, other): def __eq__(self, other):
return isinstance(other, property) and self.__name__ == other.__name__ return isinstance(other, property) and self.__name__ == other.__name__
@ -470,9 +470,7 @@ class PropertyHolder(qubes.events.Emitter):
if load_stage is not None: if load_stage is not None:
props = set(prop for prop in props props = set(prop for prop in props
if prop.load_stage == load_stage) if prop.load_stage == load_stage)
return sorted(props, return sorted(props)
key=lambda prop: (prop.load_stage, prop.order, prop.__name__))
def _property_init(self, prop, value): def _property_init(self, prop, value):
'''Initialise property to a given value, without side effects. '''Initialise property to a given value, without side effects.