-
Notifications
You must be signed in to change notification settings - Fork 64
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
ignore trailing .0 in version comparison #196
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this code also be found somewhere in the conda codebase? I followed that pretty closely.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this code also be found somewhere in the conda codebase? I followed that pretty closely.
I can try to find the place in the conda code but this was an issue i observed while debugging resolvelib stuff |
We actually did copy the docs for it! :) https://github.com/mamba-org/rattler/blob/001f326c7c3160637c8778c5a1c33f715266434e/crates/rattler_conda_types/src/version/mod.rs#L71-L72 |
And this is the code in conda: def _eq(self, t1, t2):
for v1, v2 in zip_longest(t1, t2, fillvalue=[]):
for c1, c2 in zip_longest(v1, v2, fillvalue=self.fillvalue):
if c1 != c2:
return False
return True |
Btw. I think we're also missing an compare of the |
Nice!
|
I am confused by the follownig:
The norm doesn't seem to be the epoch but rather the string representation of the version? |
E.g. this is what I see in debug print:
|
I attempted what you asked but there I am a bit unsure about a couple things. I had to add Also I had to implement a custom hash function. I am now removing all default values (0) from the hash. Clippy was warning that the hash function needs to match the |
This looks good to me! The warning about the hash is also very correct! Very nice! The |
Not sure if this is the cleanest way of implementing this behavior, but in order to fix #194 we need to ignore trailing
0
when comparing versions for equality.