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

Make sure namespace packages (e.g. virtualenvwrapper) don't break pex #338

Merged
merged 3 commits into from
Jan 6, 2017

Conversation

itamarst
Copy link
Contributor

@itamarst itamarst commented Jan 5, 2017

Fixes #337.

Let me know what else I can do to get this accepted.

@itamarst itamarst changed the title Fix for _NamespacePath breaking module minimilization code Make sure namespace packages (e.g. virtualenvwrapper) don't break pex Jan 5, 2017
@itamarst
Copy link
Contributor Author

itamarst commented Jan 5, 2017

I'll fix the (minor style) error tomorrow.

Copy link
Contributor

@kwlzn kwlzn left a comment

Choose a reason for hiding this comment

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

lgtm, one thought.

try:
module.__path__[0]
except (TypeError, KeyError, IndexError):
TRACER.log('Dropping %s' % (module_name,), V=3)
Copy link
Contributor

Choose a reason for hiding this comment

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

given the treatment of module.__path__ on the lines below - which includes index access as well as a .pop() method call - I wonder if an explicit type check might be more appropriate as a drop condition vs the attempted index access?

e.g.

if not isinstance(module.__path__, list):
  TRACER.log(...)
  continue

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@itamarst
Copy link
Contributor Author

itamarst commented Jan 6, 2017

OK, updated. Thanks for the quick review!

A speedy release would be nice: for server-side deploys this is less of an issue, but for my use case (distributing developer tools) this is a blocking bug. If anyone else is using pex to distribute developer tools their tool will be breaking at random.

@kwlzn kwlzn merged commit 7d2dc7f into pex-tool:master Jan 6, 2017
@kwlzn kwlzn mentioned this pull request Jan 6, 2017
@kwlzn
Copy link
Contributor

kwlzn commented Jan 12, 2017

@itamarst thanks for the PR! this went out in the 1.1.19 release today.

facebook-github-bot pushed a commit to facebook/buck that referenced this pull request Nov 1, 2017
Summary: This diff is basically just an import of pex-tool/pex#338, but without the tests (we don't have the pex tests in this repo?). This solves a problem where the pex would fail to run any time you had a namespaced package in your path.

Test Plan: eyes

Reviewed By: sdwilsh

fbshipit-source-id: 8d500c3
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.

2 participants