summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/version.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/spack/spack/version.py b/lib/spack/spack/version.py
index 385f8f6c03..9108b1feb5 100644
--- a/lib/spack/spack/version.py
+++ b/lib/spack/spack/version.py
@@ -167,7 +167,7 @@ class VersionStrComponent(object):
class Version(object):
"""Class to represent versions"""
- __slots__ = ['version', 'separators', 'string', 'commit_lookup']
+ __slots__ = ['version', 'separators', 'string', 'is_commit', 'commit_lookup']
def __init__(self, string):
if not isinstance(string, str):
@@ -189,6 +189,8 @@ class Version(object):
)
self.separators = tuple(m[2] for m in segments)
+ self.is_commit = len(self.string) == 40 and COMMIT_VERSION.match(self.string)
+
def _cmp(self, other_lookups=None):
commit_lookup = self.commit_lookup or other_lookups
@@ -206,15 +208,6 @@ class Version(object):
return self.version
@property
- def is_commit(self):
- """
- Determine if the original string is referencing a commit.
- """
- if self.string in infinity_versions:
- return False
- return COMMIT_VERSION.match(self.string) is not None
-
- @property
def dotted(self):
"""The dotted representation of the version.