MachineInfo: Make equality structural

For existing use cases, pointer equality sufficies, but structural is
much better going forward: these are intended to be immutable
descriptors of the machines.
pull/4326/head
John Ericson 6 years ago
parent d69d2697cd
commit 0b1fb51b66
  1. 14
      mesonbuild/environment.py

@ -1119,6 +1119,20 @@ class MachineInfo:
self.cpu = cpu
self.endian = endian
def __eq__(self, other):
if self.__class__ is not other.__class__:
return NotImplemented
return \
self.system == other.system and \
self.cpu_family == other.cpu_family and \
self.cpu == other.cpu and \
self.endian == other.endian
def __ne__(self, other):
if self.__class__ is not other.__class__:
return NotImplemented
return not self.__eq__(other)
@staticmethod
def detect(compilers = None):
"""Detect the machine we're running on

Loading…
Cancel
Save