diff options
author | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2019-08-23 23:11:00 +0200 |
---|---|---|
committer | Raphaël Barrois <raphael.barrois@polytechnique.org> | 2019-08-26 21:33:28 +0200 |
commit | 5b9174aedaf9843ee5b3b6358461910e328e74d1 (patch) | |
tree | 4d32c28d3f0787bab7b73fb704cc6411bb08da9f /docs | |
parent | 0b0f9d3f2f5ffa1afe9452ec55d394d4bb1ba190 (diff) | |
download | semantic-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 'docs')
-rw-r--r-- | docs/django.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/django.rst b/docs/django.rst index a43c3ed..ab98e67 100644 --- a/docs/django.rst +++ b/docs/django.rst @@ -6,7 +6,7 @@ Interaction with Django The ``python-semanticversion`` package provides two custom fields for Django: - :class:`VersionField`: stores a :class:`semantic_version.Version` object -- :class:`SpecField`: stores a :class:`semantic_version.Spec` object +- :class:`SpecField`: stores a :class:`semantic_version.BaseSpec` object Those fields are :class:`django.db.models.CharField` subclasses, with their :attr:`~django.db.models.CharField.max_length` defaulting to 200. @@ -28,4 +28,10 @@ with their :attr:`~django.db.models.CharField.max_length` defaulting to 200. .. class:: SpecField - Stores a :class:`semantic_version.Spec` as its comma-separated string representation. + Stores a :class:`semantic_version.BaseSpec` as its textual representation. + + .. attribute:: syntax + + The syntax to use for the field; defaults to ``'native'``. + + .. versionaddedd:: 2.7 |