summaryrefslogtreecommitdiff
path: root/semantic_version
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2016-02-21 18:54:02 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2016-02-21 18:54:02 +0100
commitd10ab4cb1d1ca8090132f205017dfc90473c91cc (patch)
tree7924515805bcfb6960d28c59ea7425452db14f3a /semantic_version
parent9872b3940e87d1d810560ea4381929554fd8038c (diff)
downloadsemantic-version-d10ab4cb1d1ca8090132f205017dfc90473c91cc.tar.gz
Fix handling pre-1.0.0 caret versions (Closes #35)
Thanks to @autopulated for pointing the issue!
Diffstat (limited to 'semantic_version')
-rw-r--r--semantic_version/base.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/semantic_version/base.py b/semantic_version/base.py
index 8877dbf..1504642 100644
--- a/semantic_version/base.py
+++ b/semantic_version/base.py
@@ -459,7 +459,13 @@ class SpecItem(object):
elif self.kind == self.KIND_NEQ:
return version != self.spec
elif self.kind == self.KIND_CARET:
- return self.spec <= version < self.spec.next_major()
+ if self.spec.major != 0:
+ upper = self.spec.next_major()
+ elif self.spec.minor != 0:
+ upper = self.spec.next_minor()
+ else:
+ upper = self.spec.next_patch()
+ return self.spec <= version < upper
elif self.kind == self.KIND_TILDE:
return self.spec <= version < self.spec.next_minor()
else: # pragma: no cover