aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2018-10-05 11:39:25 -0400
committerJohn Ericson <git@JohnEricson.me>2018-10-05 23:31:16 -0400
commit0b1fb51b66f9cccfbd645534434df65270fba606 (patch)
treefaa8302d979f1a1b14c1b67cd95152d4ef63d809
parentd69d2697cd24bd59181916f39c4284a7679b6da4 (diff)
downloadmeson-0b1fb51b66f9cccfbd645534434df65270fba606.zip
meson-0b1fb51b66f9cccfbd645534434df65270fba606.tar.gz
meson-0b1fb51b66f9cccfbd645534434df65270fba606.tar.bz2
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.
-rw-r--r--mesonbuild/environment.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index fe06c36..9e010d7 100644
--- a/mesonbuild/environment.py
+++ b/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