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

Extra environment marker should evaluate correctly. #116

Closed

Conversation

GabrielC101
Copy link

Requirement class should convert names to "safe"/"canonicalized" names. I've used some functions from setuptools to accomplish this (copied and pasted them). The canonicalized method did something slightly different.

I believe this issue has manifested itself in pypa/pip#4617

I've been researching this in pypa/pip#4901

Is the safe/canonicalize discrepancy an issue?

@GabrielC101
Copy link
Author

Well, safe extras/names cause tests to fail. So there’s that.

@GabrielC101 GabrielC101 closed this Dec 6, 2017
@GabrielC101 GabrielC101 force-pushed the canonicalize-extras-and-names branch from 129f5cd to d2ed39a Compare December 6, 2017 04:34
@GabrielC101 GabrielC101 reopened this Dec 6, 2017
@GabrielC101
Copy link
Author

Last merge breaks tons of stuff, but is a rough idea of what should be done.
Beyond breaking everything, it needs to look for all extras, not just those with a certain location.

@GabrielC101
Copy link
Author

What does the error generated in the last test mean?

ERROR: InvocationError: '/home/travis/build/pypa/packaging/.tox/py27/bin/python -m coverage report -m --fail-under 100'

This branch is working perfectly on my local box. Is this a problem with Travis? Or repo settings? Or there something wrong with my code . . .

@xavfernandez
Copy link
Member

@GabrielC101 packaging requires 100% test coverage and some of the lines you added aren't covered:
packaging/markers.py 168 3 63 1 98% 317-318, 330, 294->291

@GabrielC101
Copy link
Author

GabrielC101 commented Dec 10, 2017

Thanks! @xavfernandez

@GabrielC101 GabrielC101 changed the title Canonicalize extras and names. Markers correctly normalize extra names. Dec 11, 2017
@GabrielC101
Copy link
Author

This PR will create a special rule for Markers that consist of variable='extra', operator=('==', '===', '!=', 'is', 'is not'), and value(*). The rule will normalize the value, and make it lower case.

It seems name normalization isn't implemented in packaging. The canonicalize_name function was introduced for PEP 503 compliance. But it's never been implemented. It's only called by testing files.

Does anyone object to this approach? Will implementing name normalization open up a can of worms?

Does anyone want to share some constructive criticism? I'm worried my approach is too ad-hoc, and parsing/normalization should be more systematic.

Any help/thoughts is appreciated.

@GabrielC101 GabrielC101 force-pushed the canonicalize-extras-and-names branch from 2faebb1 to 335e240 Compare December 11, 2017 19:48
@GabrielC101 GabrielC101 force-pushed the canonicalize-extras-and-names branch from 335e240 to fc7d3db Compare December 11, 2017 19:51
@GabrielC101 GabrielC101 force-pushed the canonicalize-extras-and-names branch from 99fb2e4 to 9f233a8 Compare December 12, 2017 00:10
@GabrielC101 GabrielC101 changed the title Markers correctly normalize extra names. Extra environment marker should evaluate correctly. Dec 12, 2017
@pradyunsg
Copy link
Member

Closing since #545 solved the problem that this PR was intended to solve!

Thanks for filing this PR @GabrielC101! ^>^

@pradyunsg pradyunsg closed this Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants