diff options
author | Dave Hall <dave.hall@skwashd.com> | 2015-10-19 16:54:16 +1100 |
---|---|---|
committer | Dave Hall <dave.hall@skwashd.com> | 2015-11-29 23:49:21 +1100 |
commit | a8a75320eb274ed27227b70a3d4d090c4674237d (patch) | |
tree | a84a9fda4645ec658d49a06481aea262d689b9f7 /semantic_version | |
parent | 6004bfd349a0707309be52fc4d418fc579dc91d4 (diff) | |
download | semantic-version-a8a75320eb274ed27227b70a3d4d090c4674237d.tar.gz |
Support for alternative equals specs
Composer assumes equals if no operator is used
npm uses a single equals operator
Diffstat (limited to 'semantic_version')
-rw-r--r-- | semantic_version/base.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/semantic_version/base.py b/semantic_version/base.py index deebbc9..d0f5db8 100644 --- a/semantic_version/base.py +++ b/semantic_version/base.py @@ -389,13 +389,15 @@ class SpecItem(object): KIND_LT = '<' KIND_LTE = '<=' KIND_EQUAL = '==' + KIND_SHORTEQ = '=' + KIND_EMPTY = '' KIND_GTE = '>=' KIND_GT = '>' KIND_NEQ = '!=' KIND_CARET = '^' KIND_TILDE = '~' - re_spec = re.compile(r'^(<|<=|==|>=|>|!=|\^|~)(\d.*)$') + re_spec = re.compile(r'^(<|<=|={,2}|>=|>|!=|\^|~)(\d.*)$') def __init__(self, requirement_string): kind, spec = self.parse(requirement_string) @@ -430,7 +432,7 @@ class SpecItem(object): return version < self.spec elif self.kind == self.KIND_LTE: return version <= self.spec - elif self.kind == self.KIND_EQUAL: + elif self.kind in [self.KIND_EQUAL, self.KIND_SHORTEQ, self.KIND_EMPTY]: return version == self.spec elif self.kind == self.KIND_GTE: return version >= self.spec |