summaryrefslogtreecommitdiff
path: root/semantic_version/__init__.py
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2019-08-23 23:11:00 +0200
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2019-08-26 21:33:28 +0200
commit5b9174aedaf9843ee5b3b6358461910e328e74d1 (patch)
tree4d32c28d3f0787bab7b73fb704cc6411bb08da9f /semantic_version/__init__.py
parent0b0f9d3f2f5ffa1afe9452ec55d394d4bb1ba190 (diff)
downloadsemantic-version-5b9174aedaf9843ee5b3b6358461910e328e74d1.tar.gz
Refactor spec/version matching.
Instead of choosing the comparison on each `.match()` call, the expression is converted to a combination of `Range()` expressions (simple comparison to a semver-compliant `Version`). `Range()` objects can be combined with `And` and `Or` through the `AnyOf` and `AllOf` clauses (sticking to Python's naming scheme). Some specific flags have been provided to those range, allowing users to subtly alter the matching behaviour - thus accomodating different versioning schemes: - `<0.1.2` won't match `0.1.2-rc1`, unless the prerelease_policy flag is set to either `always` or `same-patch` - `<0.1.2` will match `0.1.1-rc1`, unless the `prerelease_policy` flag is set to `same-patch` - `==0.1.2` will always match `0.1.2+build44`, unless the `build_policy` is set to `strict`. The `Spec` item has been updated, alongside `SpecItem`. Those objects keep the original expression as attributes, but don't use them for comparisons.
Diffstat (limited to 'semantic_version/__init__.py')
-rw-r--r--semantic_version/__init__.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/semantic_version/__init__.py b/semantic_version/__init__.py
index 6e63df7..ca30919 100644
--- a/semantic_version/__init__.py
+++ b/semantic_version/__init__.py
@@ -3,7 +3,7 @@
# This code is distributed under the two-clause BSD License.
-from .base import compare, match, validate, Spec, SpecItem, Version
+from .base import compare, match, validate, NativeSpec, Spec, SpecItem, Version
__author__ = "Raphaël Barrois <raphael.barrois+semver@polytechnique.org>"