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

Abort installation on metadata mismatch #3153

Merged
merged 2 commits into from
Oct 5, 2015

Conversation

xavfernandez
Copy link
Member

If setup.py egg_info produces metadata for a different project name than
self.req.project_name, abort the installation.
Fixes #3143

@@ -421,6 +421,14 @@ def run_egg_info(self):
self.pkg_info()["Version"],
]))
self._correct_build_location()
else:
metadata_name = canonicalize_name(self.pkg_info()["Name"])
if self.req.project_name.lower() != metadata_name:
Copy link
Contributor

Choose a reason for hiding this comment

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

If we're canonicalizing stuff, why not canonicalize instead of .lower()'ing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well self.req.project_name.lower() is equivalent to the canonical name but I agree this is not clear (and only true for the current definition of canonicalize_name). I'll canonicalize_name both terms.

@dstufft
Copy link
Member

dstufft commented Oct 1, 2015

It might make sense to call this out as a backwards incompatible change, but I'm not dead set on it.

If setup.py egg_info produces metadata for a different project name than
self.req.project_name, abort the installation.
Fixes pypa#3143
@xavfernandez
Copy link
Member Author

@dstufft Moved the changelog to backward incompatible

xavfernandez added a commit that referenced this pull request Oct 5, 2015
@xavfernandez xavfernandez merged commit 6aab626 into pypa:develop Oct 5, 2015
@xavfernandez xavfernandez deleted the error_project_name_mismatch branch October 5, 2015 21:55
metadata_name = canonicalize_name(self.pkg_info()["Name"])
if canonicalize_name(self.req.project_name) != metadata_name:
raise InstallationError(
'Running setup.py (path:%s) egg_info for package %s '
Copy link
Contributor

Choose a reason for hiding this comment

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

I know this is after merge, but thinking the message should mention the url (if present) with the #egg fragment, or otherwise I'm not sure people will connect the dots that the problem is simply due to the fragment being wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

pip errors just after cloning the repository, so the error seemed sufficient to me:

Obtaining djpyfs from git+https://github.com/pmitros/django-pyfs.git#egg=djpyfs (from -r /home/xfernandez/some_requirements.txt (line 7))
  Cloning https://github.com/pmitros/django-pyfs.git to ./src/djpyfs
Running setup.py (path:/home/xfernandez/.virtualenvs/d694c7c01647e1aa/src/djpyfs/setup.py) egg_info for package djpyfs produced metadata for project name django-pyfs

@qwcode
Copy link
Contributor

qwcode commented Oct 6, 2015

I don't know for sure, but concerned this will break many builds. It could be worth only warning for the next release.

@xavfernandez
Copy link
Member Author

A warning could indeed help with the transition but on the other end the fix is pretty simple and I'm tempted to think it isn't that frequent...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants