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

Fix pex force local to handle PEP 420. #613

Merged
merged 3 commits into from
Nov 28, 2018
Merged

Conversation

jsirois
Copy link
Member

@jsirois jsirois commented Oct 29, 2018

Previously, pex would blow up trying to adjust import paths if a PEP-420
implicit namespace package was encountered. Add a test of the path
adjustment functionality both to confirm it was needed (it was) and that
the fix technique works with all forms of namespace packages by only
assuming they support append.

Fixes #598

@jsirois
Copy link
Member Author

jsirois commented Oct 29, 2018

NB: This is feathered off of #612 which was required to provide stable behavior of setuptools (pkg_resources) namespace packages which varied in at least 3 ways over versions of setuptools PEX previously claimed to support.

Reviewable changes are contained in beb77bd

@jsirois
Copy link
Member Author

jsirois commented Nov 26, 2018

Rebased against master now that vendoring change is in. This is just a CI burn, one more cleanup pass and I'll ping reviewers for another look.

Previously, pex would blow up trying to adjust import paths if a PEP-420
implicit namespace package was encountered. Add a test of the path
adjustment functionality both to confirm it was needed (it was) and that
the fix technique works with all forms of namespace packages by only
assuming they support `append`.

To support all this, work around a pypy zipimporter bug:
https://bitbucket.org/pypy/pypy/issues/1686 and, as a side-effect,
eliminate our CI workaround for the pypy unit test shard.

Fixes pex-tool#598
Fixes pex-tool#497
@jsirois
Copy link
Member Author

jsirois commented Nov 26, 2018

Alright - ready for re-review. Thanks again in advance!

Copy link

@stuhood stuhood left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

This is great to see PEP 420 support! Thanks for adding this.

pex/bootstrap.py Show resolved Hide resolved
pex/bootstrap.py Outdated Show resolved Hide resolved
pex/environment.py Outdated Show resolved Hide resolved
pex/environment.py Show resolved Hide resolved
@jsirois
Copy link
Member Author

jsirois commented Nov 27, 2018

Noting the OSX errors look like the classic, befuddling /private/var/folders vs /var/folders - os.path.realpath needed - thing:

File "/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmp8ecs_u41/pex2/.bootstrap/pex/compatibility.py", line 81, in exec_function
    exec(ast, globals_map, locals_map)
  File "/private/var/folders/nz/vv4_9tw56nv9k3tkvyszvwg80000gn/T/tmp8ecs_u41/pex2/.deps/foo_bar_baz-0.0.1-py3-none-any.whl/bin/foobaz", line 6, in <module>
    sys.exit(baz.main())

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Changes look great. This is a very high quality PR. Thanks John! 🎉

@jsirois
Copy link
Member Author

jsirois commented Nov 28, 2018

Thanks for the reviews and suggestions folks! Green and merging.

@jsirois jsirois merged commit 0fd4849 into pex-tool:master Nov 28, 2018
@jsirois jsirois deleted the issues/598 branch November 28, 2018 01:19
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

Successfully merging this pull request may close these issues.

unhandled AttributeError during pex bootstrapping with PEX_PATH
3 participants