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

Support PathResource that comes from egg #139

Closed
wants to merge 2 commits into from

Conversation

palexander
Copy link

I was seeing failures when creating an entry point to a script that was included in an egg. I'm not super familiar with the pex internals, but it seemed to only happen when the pex was actually executing (IE it found the script during the build process but not during execution).

My guess is that the eggs get converted to a PathResource at some point and since the PathResource is treated the same as a WheelResource it fails on paths that came from eggs because the scripts directory is in a different location.

My fix was to try both finding scripts from an egg location and from a wheel location when a PathResource is found. I'm happy to add/update tests if you can point me to the relevant ones.

@wickman
Copy link
Contributor

wickman commented Aug 11, 2015

Thanks for the report; I am able to repro simply with boto.

With wheel:

mba=pex=; pex boto -o /tmp/boto.pex
mba=pex=; PEX_SCRIPT=glacier /tmp/boto.pex | head -5
glacier <command> [args]

    Commands
        vaults    - Operations with vaults

With egg:

mba=pex=; pex boto --no-wheel -o /tmp/boto.pex
mba=pex=; PEX_SCRIPT=glacier /tmp/boto.pex
Traceback (most recent call last):
  File ".bootstrap/_pex/pex.py", line 319, in execute
  File ".bootstrap/_pex/pex.py", line 254, in _wrap_coverage
  File ".bootstrap/_pex/pex.py", line 286, in _wrap_profiling
  File ".bootstrap/_pex/pex.py", line 356, in _execute
  File ".bootstrap/_pex/pex.py", line 389, in execute_script
_pex.pex.NotFound: Could not find script glacier in pex!

Let me dig in to see what precisely is going on (since I believe we have test coverage for this) and then I will address your PR.

@wickman wickman added the bug label Aug 11, 2015
@wickman
Copy link
Contributor

wickman commented Aug 11, 2015

Confirmed -- we were only testing zip-safe eggs/wheels in test_pex_script in tests/test_pex.py. When parameterizing on zip_safe=True/False, the test case failed for 2 of 8 combinations.

wickman added a commit to wickman/pex that referenced this pull request Aug 11, 2015
@wickman wickman closed this in bc0edf4 Aug 11, 2015
lorencarvalho added a commit to lorencarvalho/pex that referenced this pull request Oct 8, 2015
* upstream/master:
  Migrate to the new travis-ci infra.
  [docs] update header in index.rst
  Add docs, change default behavior to use namesake command as pex.
  bdist_pex: Nicer output filename
  Don't choke if pkg has no console_scripts
  Allows --pex-args to take an argument
  Initial implementation of bdist_pex.
  Fix missed mock of safe_mkdir.  Pin pytest to 2.5.2.
  Add pex-identifying User-Agent to requests sessions.
  Fix the docs release headers.
  Normalize all names in ResolvableSet.  Fixes pex-tool#147.
  Release 1.0.3
  Fix pex-tool#139: PEX_SCRIPT fails for scripts from not-zip-safe eggs.
  Fix a logging typo when determining the minimum sys.path
  Remove unnecessary stderr print on SystemExit().code == None
  Bump the pre-release version and update the change log.
  Accomodate OSX `Python` python binaries.
  Release 1.0.2
  Address pex-tool#141.  Update version.py to reflect 1.0.2.dev0.
  Fix from_env to capture only explicitly set values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants