Skip to content

Conversation

@kszucs
Copy link
Member

@kszucs kszucs commented Oct 22, 2020

New releases of python-semver don't support comparing VersionInfo objects with strings.

@github-actions
Copy link

Copy link
Member Author

@kszucs kszucs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@terencehonles
Copy link
Contributor

New releases of python-semver don't support comparing VersionInfo objects with strings.

@kszucs the underlying cause is constructor changed. The compare method would automatically call parse and that would try to construct a Version object, but since the signature changed it would break.

I was thinking about opening a PR, but I would need some input from you if what I was thinking was actually the direction that should be taken. I had the following diff, but I wasn't sure if Version objects should be compared to non version objects because they would not have the release/release_date properties. That was already an issue, and while I hadn't tested this yet (I just pinned semver in the PR I was working on), I believe it will work.

diff --git a/dev/archery/archery/release.py b/dev/archery/archery/release.py
index 0d9efdb2e..73ae1ddc6 100644
--- a/dev/archery/archery/release.py
+++ b/dev/archery/archery/release.py
@@ -37,18 +37,17 @@ def cached_property(fn):
 
 class Version(SemVer):
 
-    __slots__ = SemVer.__slots__ + ('released', 'release_date')
+    __slots__ = ('released', 'release_date')
 
-    def __init__(self, version_string, released=False, release_date=None):
-        semver = SemVer.parse(version_string)
-        super().__init__(**semver.to_dict())
+    def __init__(self, *args, released=False, release_date=None, **kwargs):
+        super().__init__(*args, **kwargs)
         self.released = released
         self.release_date = release_date
 
     @classmethod
     def from_jira(cls, jira_version):
         return cls(
-            version_string=jira_version.name,
+            **SemVer.parse(jira_version.name).to_dict(),
             released=jira_version.released,
             release_date=getattr(jira_version, 'releaseDate', None)
         )

Additionally semver should be pinned to semver > 2.10.2

@kou
Copy link
Member

kou commented Oct 23, 2020

FYI: #8501

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants