Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version Comparison Broken #17

Closed
andrewcchen opened this issue Dec 3, 2016 · 3 comments
Closed

Version Comparison Broken #17

andrewcchen opened this issue Dec 3, 2016 · 3 comments

Comments

@andrewcchen
Copy link
Contributor

To reproduce

>>> from libPyKAN.version import Version
>>> Version("1.2") <= Version("1.2.1")
False

Breaks installing mods only compatible with 1.2 on 1.2.1 install with minKSPversion set to 1.2.

@andrewcchen
Copy link
Contributor Author

Well ... found problem ... easy fix:

diff --git a/libPyKAN/version.py b/libPyKAN/version.py
index 298697d..e8045bd 100644
--- a/libPyKAN/version.py
+++ b/libPyKAN/version.py
@@ -78,7 +78,7 @@ class Version(object):
         if str(self) == 'any' or str(other) == 'any':
             return 0
         if len(other.versionlist) > len(self.versionlist):
-            return other.__cmp__(self)
+            return -other.__cmp__(self)
         for c,i in enumerate(self.versionlist):
             try:
                 j = other.versionlist[c]

@ajventer
Copy link
Owner

ajventer commented Dec 4, 2016

Create a pull request please and I'll merge it.

andrewcchen pushed a commit to andrewcchen/pyKAN that referenced this issue Dec 5, 2016
ajventer added a commit that referenced this issue Dec 5, 2016
@ajventer
Copy link
Owner

ajventer commented Dec 5, 2016

Merged. Thanks. Such a silly bug. I spent ages looking for it. That's always how it goes eh - the simplest bugs are the hardest to find.

@ajventer ajventer closed this as completed Dec 5, 2016
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

No branches or pull requests

2 participants