-
Notifications
You must be signed in to change notification settings - Fork 12
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
add VersionMap helper #542
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.
This looks good!
@dhellmann I think there's a minor error in the lookup() code. See 7749583 . I'm testing a patch right now. |
@prarit I'm not quite sure I understand, but I think the tests here and here demonstrate that a requirement without a version specifier works with and without constraints. If I'm wrong, could you add a comment to the tests with an assert that would fail? |
4bfcfe2
to
7565f64
Compare
I added a test for the flag for allowing pre-release versions. |
So it's not the check as I thought but an issue with existing version maps in builder. The aotriton versionmap can be tested as: `def test_with_constraint_fails(): m = VersionMap({Version("0.4.1b0"): "0.4.1b", Version("0.6b0"): "0.6b"}) [edit: I should add, the difference between the string and the Version in the VersionMap is intentional. The Version refers to the python package name, and the string refers to the github tarball name. Setting allow_prerelease=True does not seem to help. We could (should?) perhaps separate the builder python package and tarball name mapping into their own maps as a solution.] [edit2 post workout clarity: Another solution here is to write a builder helper function in package_plugins/utils.py that 'does the right thing' and creates a versionmap with matching values to pass into the fromager code. That seems way easier and smarter IMO. That way there's no rewriting of builder code Version usage. Let me code that in the AM. It's a bit late now. Hope you're okay with the delay @dhellmann ] |
a7b0c17
to
533c716
Compare
The map doesn't do the same thing as the resolver function. The resolver tells you a version that matches. The map figures that value out, then returns the corresponding value in the dictionary. I've changed the API to return both the version and the value, and updated the test content to make it clearer which is which. |
533c716
to
ebf2345
Compare
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.
This looks good!
Resolves #489