Skip to content

Commit

Permalink
[rebase] start on #86 second try, first: s/Spec/SimpleSpec/ and chang…
Browse files Browse the repository at this point in the history
…elog
  • Loading branch information
bitprophet committed Jan 29, 2020
1 parent d8f76f6 commit 812c8c7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 10 deletions.
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ Changelog
=========

- :release:`2.0.0 <2020-01-25>`
- :support:`86` (really a continuation of :issue:`84`) Update our use of
``semantic_version`` to adhere to its contemporary API. While this is
primarily internally-facing, be aware of the following:

- We used to expose ``semantic_version``'s ``Spec`` class in our own
``__init__`` and ``models`` modules; we're now more properly using
``SimpleSpec``.

- :support:`-` Dropped support for Sphinx <1.8, which is now pretty rare in the
wild. This makes it easier to support Sphinx 1.8+ and lets us drop an
ever-growing amount of compatibility code for Sphinx 1.3-1.7.
Expand Down
10 changes: 5 additions & 5 deletions releases/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from docutils.parsers.rst import roles
import six

from .models import Issue, ISSUE_TYPES, Release, Version, Spec
from .models import Issue, ISSUE_TYPES, Release, Version, SimpleSpec
from .line_manager import LineManager
from ._version import __version__

Expand Down Expand Up @@ -39,7 +39,7 @@ def issue_nodelist(name, identifier=None):

def scan_for_spec(keyword):
"""
Attempt to return some sort of Spec from given keyword value.
Attempt to return some sort of SimpleSpec from given keyword value.
Returns None if one could not be derived.
"""
Expand All @@ -48,11 +48,11 @@ def scan_for_spec(keyword):
# First, test for intermediate '1.2+' style
matches = release_line_re.findall(keyword)
if matches:
return Spec(">={}".format(matches[0]))
return SimpleSpec(">={}".format(matches[0]))
# Failing that, see if Spec can make sense of it
try:
return Spec(keyword)
# I've only ever seen Spec fail with ValueError.
return SimpleSpec(keyword)
# I've only ever seen SimpleSpec fail with ValueError.
except ValueError:
return None

Expand Down
10 changes: 5 additions & 5 deletions releases/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from operator import xor

from docutils import nodes
from semantic_version import Version as StrictVersion, Spec
from semantic_version import Version as SimpleVersion, SimpleSpec
import six


Expand Down Expand Up @@ -79,17 +79,17 @@ def minor_releases(self, manager):

def default_spec(self, manager):
"""
Given the current release-lines structure, return a default Spec.
Given the current release-lines structure, return a default SimpleSpec.
Specifics:
* For feature-like issues, only the highest major release is used, so
given a ``manager`` with top level keys of ``[1, 2]``, this would
return ``Spec(">=2")``.
return ``SimpleSpec(">=2")``.
* When ``releases_always_forwardport_features`` is ``True``, that
behavior is nullified, and this function always returns the empty
``Spec`` (which matches any and all versions/lines).
``SimpleSpec`` (which matches any and all versions/lines).
* For bugfix-like issues, we only consider major release families which
have actual releases already.
Expand Down Expand Up @@ -120,7 +120,7 @@ def default_spec(self, manager):
buckets = self.minor_releases(manager)
if buckets:
specstr = ">={}".format(max(buckets))
return Spec(specstr) if specstr else Spec()
return SimpleSpec(specstr) if specstr else SimpleSpec()

def add_to_manager(self, manager):
"""
Expand Down

0 comments on commit 812c8c7

Please sign in to comment.