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

Provide automatic removal of pkg-resources==0.0.0 #275

Merged

Conversation

nvtkaszpir
Copy link
Contributor

Should help to deal with that pretty paintuly issue under Ubuntu/Debian
family:
https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463

Should help to deal with that pretty paintuly issue under Ubuntu/Debian
family:
https://bugs.launchpad.net/ubuntu/+source/python-pip/+bug/1635463
@@ -69,6 +69,11 @@ def fix_requirements(f):
else:
rest = []

for requirement in requirements:
if b'pkg-resources' in requirement.name:
if b'0.0.0' in requirement.value:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes more sense?

if requirement.value == b'pkg-resources==0.0.0\n':
    ...

@asottile
Copy link
Member

Otherwise looks good, shame debian botched the metadata here :(

if b'0.0.0' in requirement.value:
requirements.remove(requirement)
if requirement.value == b'pkg-resources==0.0.0\n':
requirements.remove(requirement)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, now that I look at it I think this loop results in UB (modifying list while iterating over it) -- you can avoid this with:

requirements = [
    requirement for requirement in requirements
    if requirement.value != b'pkg-resources==0.0.0\n'
]

Forgot to rename one var...
@nvtkaszpir nvtkaszpir force-pushed the feature/fix-broken-pkg-resources branch from b6bdda5 to 980fc9b Compare March 25, 2018 22:42
@asottile asottile merged commit 20baf1a into pre-commit:master Mar 25, 2018
@asottile
Copy link
Member

Thanks for the feature!

@nvtkaszpir
Copy link
Contributor Author

Thanks for the comments. Looking at it now all those comments and CI failures ... it's a sign I should go to sleep ;)

@asottile
Copy link
Member

This has been (finally!) released as part of v1.3.0! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants