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

Requires-Python from Wheel needs audit #12

Open
uranusjr opened this issue Aug 21, 2018 · 4 comments
Open

Requires-Python from Wheel needs audit #12

uranusjr opened this issue Aug 21, 2018 · 4 comments

Comments

@uranusjr
Copy link
Member

No description provided.

@techalchemy
Copy link
Member

I believe we need to clean it before we build the wheel

@uranusjr
Copy link
Member Author

Forgot to mention but I experiemented a bit, and here’s the important part

def _read_requires_python(metadata):
"""Read wheel metadata to know the value of Requires-Python.
This is surprisingly poorly supported in Distlib. This function tries
several ways to get this information:
* Metadata 2.0: metadata.dictionary.get("requires_python") is not None
* Metadata 2.1: metadata._legacy.get("Requires-Python") is not None
* Metadata 1.2: metadata._legacy.get("Requires-Python") != "UNKNOWN"
"""
# TODO: Support more metadata formats.
value = metadata.dictionary.get("requires_python")
if value is not None:
return value
if metadata._legacy:
value = metadata._legacy.get("Requires-Python")
if value is not None and value != "UNKNOWN":
return value
return ""

This is almost definitely not covering all cases, but I couldn’t find many good 1.x wheel examples, so we’ll have to fix it as we go.

Also I found that even if I’m reading the correct field, JSON API and the wheel can still return different values. This is just terrible.

@techalchemy
Copy link
Member

oh yeah to summarize what we talked about whenever that was, and the reason why we have the custom cleaning stuff in pipenv, Requires-Python: 3 is completely valid for example

@uranusjr
Copy link
Member Author

Indeed. This function (or the resolver in general) does not try to actually parse the string in any sense. The parsing part is done after the resolution, by the marker thing you implemented.

@uranusjr uranusjr changed the title Requires-Python from Wheel is not working Requires-Python from Wheel needs audit Aug 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants