-
Notifications
You must be signed in to change notification settings - Fork 250
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
Support PEP 600 tags #293
Support PEP 600 tags #293
Conversation
958576a
to
372650d
Compare
It seems I need to mock some failures to get coverage to 100% |
Thanks for taking a stab at this! I haven't looked at the code, but a tweak we might want to make to the output is to emit the |
Ahh, so the correct order, assuming precedence for the perennial tags, would be this?
|
@mattip yep, exactly! Basically the way to think about the order is if I got every wheel file name for a specific version, I should be able to iterate through what This is also why everything in |
I reversed the tags and added tests for lines that weren't in the coverage report. |
Any thoughts? CI is passing, even though travis thinks it is still pending. |
Sorry, I've personally been swamped lately on top of vacation, so I just haven't had time to review the PR yet. |
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.
Just some tweaks to generalize this to > glibc 2.
packaging/tags.py
Outdated
plat, (2, glibc_minor) | ||
) | ||
if manylinux_compat: | ||
yield linux.replace("linux", plat) |
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.
Instead of doing the replacing, maybe the map should just hard-code all possible supported architectures since there aren't that many.
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.
It would only save one instance of replace
, the PEP 600 tags do not use the map.
c7b2582
to
3e8aa45
Compare
Tests are passing after fixes as per the review. The code should support newer major versions of glibc, but there still is a logic failure. We assume |
Huh, good point about the cap on glibc 2's minor number if glibc 3 ever becomes a thing. Maybe we can't generalize this for glibc 3 without hard-coding that? I guess the best fall-back is to go with your suggestion, Matti, and just assume |
Added a |
Requested changes made, there is one test failure with no log. |
Triggered a re-run for all jobs. |
Triggered a "bigger" re-run. :) |
Trying again |
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.
The refactor to allow calling a _manylinux.manylinux_compatible
function required a bit of refactoring. So basically we are back to a full review, sorry.
All but one macOS job passes |
Any thoughts? |
That I wish I had less deadlines at work? 😉 This is at the top of my review queue, but this month is not good for me for open source time. |
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.
Very small change to make to use monkeypatch in a test and then a clarifying question on a comment. Otherwise LGTM!
tests/test_tags.py
Outdated
def test_module_declaration(self, manylinux_module, attribute, glibc, tf): | ||
manylinux = "manylinux{}_compatible".format(attribute) | ||
setattr(manylinux_module, manylinux, tf) | ||
res = tags._is_manylinux_compatible(manylinux, "x86_64", glibc) | ||
assert tf is res | ||
delattr(manylinux_module, manylinux) |
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.
It's easiest to use pytest's monkeypatch
for temporarily setting an attribute:
def test_module_declaration(self, manylinux_module, attribute, glibc, tf): | |
manylinux = "manylinux{}_compatible".format(attribute) | |
setattr(manylinux_module, manylinux, tf) | |
res = tags._is_manylinux_compatible(manylinux, "x86_64", glibc) | |
assert tf is res | |
delattr(manylinux_module, manylinux) | |
def test_module_declaration(self, monkeypatch, manylinux_module, attribute, glibc, tf): | |
manylinux = "manylinux{}_compatible".format(attribute) | |
monkeypatch.setattr(manylinux_module, "manylinux", tf) | |
res = tags._is_manylinux_compatible(manylinux, "x86_64", glibc) | |
assert tf is res |
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.
I tried that. monkypatch
cannot use setattr
on an attribute that was not already present, I get
> monkeypatch.setattr(manylinux_module, manylinux, tf)
E AttributeError: <module '_manylinux'> has no attribute \
'manylinux2014_compatible'
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.
Try using raising=False
.
Sorry, I lost the thread of comments that this question relates to:
|
tests/test_tags.py
Outdated
def test_module_declaration(self, manylinux_module, attribute, glibc, tf): | ||
manylinux = "manylinux{}_compatible".format(attribute) | ||
setattr(manylinux_module, manylinux, tf) | ||
res = tags._is_manylinux_compatible(manylinux, "x86_64", glibc) | ||
assert tf is res | ||
delattr(manylinux_module, manylinux) |
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.
Try using raising=False
.
It's in response to a comment on
|
Tests are passing with monkeypatch and |
@pradyunsg did you want to do another review, or should I go ahead and merge this? |
Go ahead. I'm tied up with college reports and submissions for the next few days. |
Thanks for all the work on this, @mattip ! |
xref gh-280. This adds a whole bunch of PEP 600 tags (my python reports `os.confstr('CS_GNU_LIBC_VERSION') of 2.27): EDIT: after reversing the order in f432bcd