summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2016-03-07 12:43:55 +0000
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2016-03-07 12:43:55 +0000
commit19692604b597e6aaede114edfd4fa8627fc9fd97 (patch)
tree57cc02af9977f44a43dc1c98b77c70820ffc341b
parentec2c25cd3a46c53adbbdb411239043d237ad077f (diff)
parent2d3f694f852ac1619d673b67b115cb9bbb352c5e (diff)
downloadsemantic-version-19692604b597e6aaede114edfd4fa8627fc9fd97.tar.gz
Merge pull request #41 from ekmartin/compatible_docs
Add a doc section about compatible release clauses
-rw-r--r--docs/reference.rst6
-rw-r--r--semantic_version/base.py2
-rwxr-xr-xtests/test_base.py4
3 files changed, 11 insertions, 1 deletions
diff --git a/docs/reference.rst b/docs/reference.rst
index a645c1f..358b2c0 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -277,6 +277,11 @@ This means that::
.. note:: python-semanticversion also accepts ``"*"`` as a version spec,
that matches all (valid) version strings.
+.. note:: python-semanticversion supports PyPI-style `compatible release clauses`_:
+
+ * ``~=2.2`` means "Any release between 2.2.0 and 3.0.0"
+ * ``~=1.4.5`` means "Any release between 1.4.5 and 1.5.0"
+
.. note:: python-semanticversion includes support for NPM-style specs:
* ``~1.2.3`` means "Any release between 1.2.3 and 1.3.0"
@@ -568,3 +573,4 @@ rules apply:
.. _SemVer: http://semver.org/
+.. _`compatible release clauses`: https://www.python.org/dev/peps/pep-0440/#compatible-release
diff --git a/semantic_version/base.py b/semantic_version/base.py
index 83a9c25..0f4e11b 100644
--- a/semantic_version/base.py
+++ b/semantic_version/base.py
@@ -470,7 +470,7 @@ class SpecItem(object):
elif self.kind == self.KIND_TILDE:
return self.spec <= version < self.spec.next_minor()
elif self.kind == self.KIND_COMPATIBLE:
- if self.spec.patch:
+ if self.spec.patch is not None:
upper = self.spec.next_minor()
else:
upper = self.spec.next_major()
diff --git a/tests/test_base.py b/tests/test_base.py
index 0675b24..a1255c3 100755
--- a/tests/test_base.py
+++ b/tests/test_base.py
@@ -518,6 +518,10 @@ class SpecItemTestCase(unittest.TestCase):
['1.4.5', '1.4.10-alpha', '1.4.10'],
['1.3.6', '1.4.4', '1.5.0'],
),
+ '~=1.4.0': (
+ ['1.4.0', '1.4.10-alpha', '1.4.10'],
+ ['1.3.6', '1.3.9', '1.5.0'],
+ ),
'~=1.4': (
['1.4.0', '1.6.10-alpha', '1.6.10'],
['1.3.0', '2.0.0'],