From c90cc465f581514d18fc4fc95649f015cb178079 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Thu, 16 Jun 2016 00:54:59 -0700 Subject: Add `__contains__` to arch to satsify old packages. --- lib/spack/spack/architecture.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/architecture.py b/lib/spack/spack/architecture.py index 1f25bc14ea..df0ab5c14d 100644 --- a/lib/spack/spack/architecture.py +++ b/lib/spack/spack/architecture.py @@ -195,7 +195,7 @@ class Platform(object): name = self.back_os return self.operating_sys.get(name, None) - + @classmethod def detect(self): @@ -206,12 +206,15 @@ class Platform(object): """ raise NotImplementedError() + def __repr__(self): return self.__str__() + def __str__(self): return self.name + def _cmp_key(self): t_keys = ''.join(str(t._cmp_key()) for t in sorted(self.targets.values())) @@ -338,7 +341,6 @@ class OperatingSystem(object): d = {} d['name'] = self.name d['version'] = self.version - return d @key_ordering @@ -378,6 +380,11 @@ class Arch(object): else: return '' + + def __contains__(self, string): + return string in str(self) + + def _cmp_key(self): if isinstance(self.platform, Platform): platform = self.platform.name -- cgit v1.2.3-70-g09d2