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

Handle eggs for libraries with versions containing _ in the filename #226

Closed
baroquebobcat opened this issue Apr 6, 2016 · 4 comments
Closed

Comments

@baroquebobcat
Copy link
Contributor

In 1.1.3, there was a change that caused the versions of packages to not be normalized anymore. This is a problem because the egg filename spec normalizes versions using to_filename, which turns '-'s into '_'s. So, any egg with a version containing an '-' or any character normalized to a '-' can't be resolved with pex's resolver.

@kwlzn
Copy link
Contributor

kwlzn commented Apr 6, 2016

/cc @mikekap - this is related to your change in #204

@mikekap
Copy link
Contributor

mikekap commented Apr 7, 2016

Sorry about that. Looks like this is a bug due to an old pkg_resources used for packing the egg - the new versions don't do anything to the version: https://github.com/pypa/setuptools/blob/master/pkg_resources/__init__.py#L1381 . The proper fix looks like using safe_version. I'll send a PR.

@baroquebobcat could you tell me what package version you're seeing this with? (for a test case)

@baroquebobcat
Copy link
Contributor Author

Sure. Here's a foobarified version: pyfoo-1.0.0_bar-py2.7-linux-x86_64.egg, where the normalized version is 1.0.0-bar.

For reference, here's the egg filename metadata docs https://pythonhosted.org/setuptools/formats.html#filename-embedded-metadata

I think what we'd need to do is check the normalized safe_version-ified versions against eachother, then if they match pull down the egg and check the internal metadata which isn't filename-ified, just to be sure.

If we could ensure that pex always used a setuptools >=8.0 for the .bootstrap/pkg_resources.py, then local versions ought to work generally--though I haven't played with how they interact with egg naming conventions.

@mikekap
Copy link
Contributor

mikekap commented Apr 7, 2016

I think I rather just drop support for local specifiers if the pkg_resources you're using doesn't support them properly. The spec is out of date with what setuptools actually does, which is normalization according to https://www.python.org/dev/peps/pep-0440/ only. This would require that your eggs' pkg_resources needs to be <= pex's pkg_resources, which is reasonable.

mikekap added a commit to mikekap/pex that referenced this issue Apr 7, 2016
Before recent releases of setuptools, the version numbers in eggs were mangled. `safe_version` handles this correctly in modern `setuptools` and should work on older setuptools as well.

Closes pex-tool#226.
mikekap added a commit to mikekap/pex that referenced this issue Apr 7, 2016
Before recent releases of setuptools, the version numbers in eggs were mangled. `safe_version` handles this correctly in modern `setuptools` and should work on older setuptools as well.

Closes pex-tool#226.
stuhood pushed a commit to pantsbuild/pants that referenced this issue Apr 14, 2016
There's a bug in pex versions 1.1.3 and 1.1.4 that prevents eggs with '_'s in the version metadata in their file name from being discovered.

See pex-tool/pex#226 for more info.

Testing Done:
Reverted the version upgrade and saw the pex creation work again for a requirement with a _

Bugs closed: 3184

Reviewed at https://rbcommons.com/s/twitter/r/3687/
@ewang ewang mentioned this issue Apr 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants