From ceaee2d67bc08080166113cfda8676ea52145842b072ab39555d72366ad34615 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Wed, 18 Mar 2020 09:11:16 +0000 Subject: [PATCH 1/2] =?UTF-8?q?-=20Update=20to=201.6.3:=20=20=20-=20:suppo?= =?UTF-8?q?rt:`87=20backported`=20(via=20:issue:`88`)=20Our=20upper=20Sphi?= =?UTF-8?q?nx=20version=20limit=20was=20=20=20=20=20mostly=20defensive=20a?= =?UTF-8?q?nd=20at=20this=20point=20is=20just=20too=20old=20to=20even=20bu?= =?UTF-8?q?ild=20on=20=20=20=20=20ReadTheDocs=20successfully.=20Removed=20?= =?UTF-8?q?it=20for=20the=20time=20being.=20Thanks=20to=20Jos=C3=83=C2=A9?= =?UTF-8?q?=20=20=20=20=20S=C3=83=C2=A1nchez-Gallego=20for=20the=20nudge?= =?UTF-8?q?=20and=20the=20patch.=20=20=20-=20:support:`84=20backported`=20?= =?UTF-8?q?Pin=20us=20to=20``semantic-version<2.7``=20as=20they=20changed?= =?UTF-8?q?=20=20=20=20=20their=20APIs=20(...)=20in=20that=20version=20in?= =?UTF-8?q?=20a=20way=20that=20breaks=20us.=20We=20do=20not=20need=20=20?= =?UTF-8?q?=20=20=20anything=20they've=20added=20recently,=20so=20the=20co?= =?UTF-8?q?nservative=20response=20is=20to=20just=20pin=20=20=20=20=20unti?= =?UTF-8?q?l=20we=20truly=20need=20to=20upgrade.=20Thanks=20to=20everyone?= =?UTF-8?q?=20who=20reported=20and=20submitted=20=20=20=20=20workarounds?= =?UTF-8?q?=20for=20this.=20-=20Drop=20merged=20patch=20semanticversioning?= =?UTF-8?q?.patch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-releases?expand=0&rev=12 --- python-releases.changes | 15 ++++ python-releases.spec | 7 +- releases-1.6.1.tar.gz | 3 - releases-1.6.3.tar.gz | 3 + semanticversioning.patch | 143 --------------------------------------- 5 files changed, 20 insertions(+), 151 deletions(-) delete mode 100644 releases-1.6.1.tar.gz create mode 100644 releases-1.6.3.tar.gz delete mode 100644 semanticversioning.patch diff --git a/python-releases.changes b/python-releases.changes index 9f57855..6e61abb 100644 --- a/python-releases.changes +++ b/python-releases.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Wed Mar 18 09:08:49 UTC 2020 - Tomáš Chvátal + +- Update to 1.6.3: + - :support:`87 backported` (via :issue:`88`) Our upper Sphinx version limit was + mostly defensive and at this point is just too old to even build on + ReadTheDocs successfully. Removed it for the time being. Thanks to José + Sánchez-Gallego for the nudge and the patch. + - :support:`84 backported` Pin us to ``semantic-version<2.7`` as they changed + their APIs (...) in that version in a way that breaks us. We do not need + anything they've added recently, so the conservative response is to just pin + until we truly need to upgrade. Thanks to everyone who reported and submitted + workarounds for this. +- Drop merged patch semanticversioning.patch + ------------------------------------------------------------------- Tue Sep 17 10:11:28 UTC 2019 - Tomáš Chvátal diff --git a/python-releases.spec b/python-releases.spec index 436ef5e..fc7da40 100644 --- a/python-releases.spec +++ b/python-releases.spec @@ -1,7 +1,7 @@ # # spec file for package python # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -26,14 +26,12 @@ %bcond_with test %endif Name: python-releases%{psuffix} -Version: 1.6.1 +Version: 1.6.3 Release: 0 Summary: A Sphinx extension for changelog manipulation License: BSD-2-Clause -Group: Development/Languages/Python URL: https://github.com/bitprophet/releases Source: https://files.pythonhosted.org/packages/source/r/releases/releases-%{version}.tar.gz -Patch0: semanticversioning.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -71,7 +69,6 @@ Specifically: %prep %setup -q -n releases-%{version} -%patch0 -p1 %build %python_build diff --git a/releases-1.6.1.tar.gz b/releases-1.6.1.tar.gz deleted file mode 100644 index cbd7858..0000000 --- a/releases-1.6.1.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:7a1b3163ab062d41dc4e61d8f51df055756d146f1fb6e18ee5cf55d91c9cda54 -size 42029 diff --git a/releases-1.6.3.tar.gz b/releases-1.6.3.tar.gz new file mode 100644 index 0000000..95fffef --- /dev/null +++ b/releases-1.6.3.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:555ae4c97a671a420281c1c782e9236be25157b449fdf20b4c4b293fe93db2f1 +size 40510 diff --git a/semanticversioning.patch b/semanticversioning.patch deleted file mode 100644 index 2aeff52..0000000 --- a/semanticversioning.patch +++ /dev/null @@ -1,143 +0,0 @@ -From 8787236dffb7383427b3e1448ece9a5b3eaf5257 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= -Date: Sun, 8 Sep 2019 00:18:00 +0200 -Subject: [PATCH] Fix usage of semanticversion to intended API. - -The recent versions of python-semanticversion made changes to private -APIs, removing the interaction between `Version(x, partial=True)` and -`Spec()` (`partial=True` was designed for implementing the `Spec` class -only) - -The code used these classes to exclude ranges of version whose major -component didn't match a bugfix/issue range; the code went akin to: - - Version('1', partial=True) in Spec('>=1.0') - -This no longer works; this patch changes that behaviour to exclude -families where no actual release matches the bugfix/issue range - this -should be more accurate. - -The patch also uses `Version.coerce`, the intended API to manage -non semver-compliant version strings. - -The patch has been tested with both python-semanticversion==2.6.0 and -python-semanticversion==2.8.1; it can be included to an upgraded version -of `releases` even if users haven't yet upgraded python-semanticversion. ---- - releases/__init__.py | 2 +- - releases/models.py | 54 ++++++++++++++++++++++++-------------------- - 2 files changed, 30 insertions(+), 26 deletions(-) - -diff --git a/releases/__init__.py b/releases/__init__.py -index 3c73f0b..48fc5f5 100644 ---- a/releases/__init__.py -+++ b/releases/__init__.py -@@ -426,7 +426,7 @@ def handle_upcoming_major_release(entries, manager): - # to the line manager! - for obj in next_releases: - # TODO: update when Release gets tied closer w/ Version -- version = Version(obj.number) -+ version = Version.coerce(obj.number) - if version.minor == 0 and version.patch == 0: - manager.add_family(obj.family) - -diff --git a/releases/models.py b/releases/models.py -index d980e9c..0517174 100644 ---- a/releases/models.py -+++ b/releases/models.py -@@ -2,18 +2,10 @@ - from operator import xor - - from docutils import nodes --from semantic_version import Version as StrictVersion, Spec -+from semantic_version import Version, Spec - import six - - --class Version(StrictVersion): -- """ -- Version subclass toggling ``partial=True`` by default. -- """ -- def __init__(self, version_string, partial=True): -- super(Version, self).__init__(version_string, partial) -- -- - # Issue type list (keys) + color values - ISSUE_TYPES = { - 'bug': 'A04040', -@@ -122,7 +114,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 Spec(specstr) if specstr else Spec('*') - - def add_to_manager(self, manager): - """ -@@ -130,32 +122,43 @@ def add_to_manager(self, manager): - """ - # Derive version spec allowing us to filter against major/minor buckets - spec = self.spec or self.default_spec(manager) -- # Only look in appropriate major version/family; if self is an issue -- # declared as living in e.g. >=2, this means we don't even bother -- # looking in the 1.x family. -- families = [Version(str(x)) for x in manager] -- versions = list(spec.filter(families)) -- for version in versions: -- family = version.major -- # Within each family, we further limit which bugfix lines match up -- # to what self cares about (ignoring 'unreleased' until later) -- candidates = [ -- Version(x) -+ -+ # Browse through families, adding us to every line we match. -+ for family in manager: -+ # Map changelog keys to Version objects, keeping a link -+ # to the original text -+ versions = { -+ Version.coerce(x): x - for x in manager[family] - if not x.startswith('unreleased') -- ] -- # Select matching release lines (& stringify) -+ } -+ -+ # Bail out if no listed version (included pending feature/bugfix) -+ # match self.spec: if self is an issue for >=2, don't look -+ # at the 1.x family. If self is an issue for >=1.0, include it -+ # in the 1.x family even if no 1.0 release exists yet. -+ candidates = list(spec.filter(versions)) -+ # Also compare the first release in the family, for cases -+ # where no release has been performed yet. -+ if not candidates and Version.coerce(str(family)) not in spec: -+ continue -+ -+ # `buckets` has the list of line families - buckets = [] -- bugfix_buckets = [str(x) for x in spec.filter(candidates)] -+ bugfix_buckets = candidates - # Add back in unreleased_* as appropriate - # TODO: probably leverage Issue subclasses for this eventually? - if self.is_buglike: -- buckets.extend(bugfix_buckets) -+ # Convert back Version() to line -+ buckets.extend([ -+ versions[bucket] for bucket in bugfix_buckets -+ ]) - # Don't put into JUST unreleased_bugfix; it implies that this - # major release/family hasn't actually seen any releases yet - # and only exists for features to go into. - if bugfix_buckets: - buckets.append('unreleased_bugfix') -+ - # Obtain list of minor releases to check for "haven't had ANY - # releases yet" corner case, in which case ALL issues get thrown in - # unreleased_feature for the first release to consume. -@@ -164,6 +167,7 @@ def add_to_manager(self, manager): - no_releases = not self.minor_releases(manager) - if self.is_featurelike or self.backported or no_releases: - buckets.append('unreleased_feature') -+ - # Now that we know which buckets are appropriate, add ourself to - # all of them. TODO: or just...do it above...instead... - for bucket in buckets: From a04ab356ac0e88fd01485f7cbe6abc866cc7e40557a72bc03dc682c7288752a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 26 May 2020 07:37:36 +0000 Subject: [PATCH 2/2] Accepting request 808864 from home:bnavigator:branches:devel:languages:python The patch was never merged and its lack now breaks our neck with python-semantic_version 2.8 out for some time - Restore semanticversioning.patch to allow semantic_version >= 2.7 gh#bitprophet/releases#84 gh#bitprophet/releases#86 - remove color printout in tests OBS-URL: https://build.opensuse.org/request/show/808864 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-releases?expand=0&rev=13 --- python-releases.changes | 8 +++ python-releases.spec | 3 + semanticversioning.patch | 143 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 154 insertions(+) create mode 100644 semanticversioning.patch diff --git a/python-releases.changes b/python-releases.changes index 6e61abb..43518ac 100644 --- a/python-releases.changes +++ b/python-releases.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon May 25 21:27:01 UTC 2020 - Benjamin Greiner + +- Restore semanticversioning.patch to allow semantic_version >= 2.7 + gh#bitprophet/releases#84 + gh#bitprophet/releases#86 +- remove color printout in tests + ------------------------------------------------------------------- Wed Mar 18 09:08:49 UTC 2020 - Tomáš Chvátal diff --git a/python-releases.spec b/python-releases.spec index fc7da40..ef44ba8 100644 --- a/python-releases.spec +++ b/python-releases.spec @@ -32,6 +32,7 @@ Summary: A Sphinx extension for changelog manipulation License: BSD-2-Clause URL: https://github.com/bitprophet/releases Source: https://files.pythonhosted.org/packages/source/r/releases/releases-%{version}.tar.gz +Patch0: semanticversioning.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -69,6 +70,7 @@ Specifically: %prep %setup -q -n releases-%{version} +%patch0 -p1 %build %python_build @@ -81,6 +83,7 @@ Specifically: %if %{with test} %check +export NOSE_NO_SPEC_COLOR=1 %python_expand invoke-%{$python_bin_suffix} test %endif diff --git a/semanticversioning.patch b/semanticversioning.patch new file mode 100644 index 0000000..2aeff52 --- /dev/null +++ b/semanticversioning.patch @@ -0,0 +1,143 @@ +From 8787236dffb7383427b3e1448ece9a5b3eaf5257 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Rapha=C3=ABl=20Barrois?= +Date: Sun, 8 Sep 2019 00:18:00 +0200 +Subject: [PATCH] Fix usage of semanticversion to intended API. + +The recent versions of python-semanticversion made changes to private +APIs, removing the interaction between `Version(x, partial=True)` and +`Spec()` (`partial=True` was designed for implementing the `Spec` class +only) + +The code used these classes to exclude ranges of version whose major +component didn't match a bugfix/issue range; the code went akin to: + + Version('1', partial=True) in Spec('>=1.0') + +This no longer works; this patch changes that behaviour to exclude +families where no actual release matches the bugfix/issue range - this +should be more accurate. + +The patch also uses `Version.coerce`, the intended API to manage +non semver-compliant version strings. + +The patch has been tested with both python-semanticversion==2.6.0 and +python-semanticversion==2.8.1; it can be included to an upgraded version +of `releases` even if users haven't yet upgraded python-semanticversion. +--- + releases/__init__.py | 2 +- + releases/models.py | 54 ++++++++++++++++++++++++-------------------- + 2 files changed, 30 insertions(+), 26 deletions(-) + +diff --git a/releases/__init__.py b/releases/__init__.py +index 3c73f0b..48fc5f5 100644 +--- a/releases/__init__.py ++++ b/releases/__init__.py +@@ -426,7 +426,7 @@ def handle_upcoming_major_release(entries, manager): + # to the line manager! + for obj in next_releases: + # TODO: update when Release gets tied closer w/ Version +- version = Version(obj.number) ++ version = Version.coerce(obj.number) + if version.minor == 0 and version.patch == 0: + manager.add_family(obj.family) + +diff --git a/releases/models.py b/releases/models.py +index d980e9c..0517174 100644 +--- a/releases/models.py ++++ b/releases/models.py +@@ -2,18 +2,10 @@ + from operator import xor + + from docutils import nodes +-from semantic_version import Version as StrictVersion, Spec ++from semantic_version import Version, Spec + import six + + +-class Version(StrictVersion): +- """ +- Version subclass toggling ``partial=True`` by default. +- """ +- def __init__(self, version_string, partial=True): +- super(Version, self).__init__(version_string, partial) +- +- + # Issue type list (keys) + color values + ISSUE_TYPES = { + 'bug': 'A04040', +@@ -122,7 +114,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 Spec(specstr) if specstr else Spec('*') + + def add_to_manager(self, manager): + """ +@@ -130,32 +122,43 @@ def add_to_manager(self, manager): + """ + # Derive version spec allowing us to filter against major/minor buckets + spec = self.spec or self.default_spec(manager) +- # Only look in appropriate major version/family; if self is an issue +- # declared as living in e.g. >=2, this means we don't even bother +- # looking in the 1.x family. +- families = [Version(str(x)) for x in manager] +- versions = list(spec.filter(families)) +- for version in versions: +- family = version.major +- # Within each family, we further limit which bugfix lines match up +- # to what self cares about (ignoring 'unreleased' until later) +- candidates = [ +- Version(x) ++ ++ # Browse through families, adding us to every line we match. ++ for family in manager: ++ # Map changelog keys to Version objects, keeping a link ++ # to the original text ++ versions = { ++ Version.coerce(x): x + for x in manager[family] + if not x.startswith('unreleased') +- ] +- # Select matching release lines (& stringify) ++ } ++ ++ # Bail out if no listed version (included pending feature/bugfix) ++ # match self.spec: if self is an issue for >=2, don't look ++ # at the 1.x family. If self is an issue for >=1.0, include it ++ # in the 1.x family even if no 1.0 release exists yet. ++ candidates = list(spec.filter(versions)) ++ # Also compare the first release in the family, for cases ++ # where no release has been performed yet. ++ if not candidates and Version.coerce(str(family)) not in spec: ++ continue ++ ++ # `buckets` has the list of line families + buckets = [] +- bugfix_buckets = [str(x) for x in spec.filter(candidates)] ++ bugfix_buckets = candidates + # Add back in unreleased_* as appropriate + # TODO: probably leverage Issue subclasses for this eventually? + if self.is_buglike: +- buckets.extend(bugfix_buckets) ++ # Convert back Version() to line ++ buckets.extend([ ++ versions[bucket] for bucket in bugfix_buckets ++ ]) + # Don't put into JUST unreleased_bugfix; it implies that this + # major release/family hasn't actually seen any releases yet + # and only exists for features to go into. + if bugfix_buckets: + buckets.append('unreleased_bugfix') ++ + # Obtain list of minor releases to check for "haven't had ANY + # releases yet" corner case, in which case ALL issues get thrown in + # unreleased_feature for the first release to consume. +@@ -164,6 +167,7 @@ def add_to_manager(self, manager): + no_releases = not self.minor_releases(manager) + if self.is_featurelike or self.backported or no_releases: + buckets.append('unreleased_feature') ++ + # Now that we know which buckets are appropriate, add ourself to + # all of them. TODO: or just...do it above...instead... + for bucket in buckets: