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

--script not working with aws-cfn-bootstrap #551

Closed
sherzberg opened this issue Sep 21, 2018 · 3 comments
Closed

--script not working with aws-cfn-bootstrap #551

sherzberg opened this issue Sep 21, 2018 · 3 comments
Assignees
Labels

Comments

@sherzberg
Copy link

I'm guessing this is NOT a pex issue, but I'm having a hard time figuring out what the issue is as I have been able to successfully use --script for other packages so maybe someone here can point me in the right direction. When running pex with the aws-cfn-bootstrap:

$ pex -v --script cfn-signal https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-latest.zip
  aws-cfn-bootstrap 1.4solving distributions :: Packaging 
  pystache 0.5.4
  python-daemon 1.6.1
  lockfile 0.12.2
  setuptools 40.4.2
Traceback (most recent call last):
  File "/usr/local/bin/pex", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/pex/bin/pex.py", line 737, in main
    pex_builder = build_pex(reqs, options, resolver_options_builder)
  File "/usr/local/lib/python2.7/dist-packages/pex/bin/pex.py", line 680, in build_pex
    pex_builder.set_script(options.script)
  File "/usr/local/lib/python2.7/dist-packages/pex/pex_builder.py", line 225, in set_script
    script, ', '.join(str(d) for d in self._distributions)))
pex.pex_builder.InvalidExecutableSpecification: Could not find script 'cfn-signal' in any distribution python-daemon 1.6.1, setuptools 40.4.2, pystache 0.5.4, lockfile 0.12.2, aws-cfn-bootstrap 1.4 within PEX!

The bin/cfn-signal script is listed in the setup.py file. I have also tried the above pex command with bin/cfn-signal which shows the same error as above.

Inside a virtualenv, if I install this same zipfile, the cfn-signal is runnable as I expect.

Versions:

sherzberg@lla434d9ba5162~/workspace
$ pex --version
pex 1.4.6
sherzberg@lla434d9ba5162~/workspace
$ python --version
Python 2.7.12

Any ideas on what the issue could be?

@jsirois
Copy link
Member

jsirois commented Oct 12, 2018

This is definitely a bug! We do not properly normalize - to _ in distribution names when searching for script paths. Fix coming.

@jsirois
Copy link
Member

jsirois commented Oct 12, 2018

Tangentially related: #383 That issue similarly concerned distributions with - in the name, but differently revolved around the generated wheel file name not properly using _ in place of -; ie: the problem was on the wheel generation end and out of pex's control. In this case pex is failing to convert - to _ when searching for a data directory internal to the wheel file itself; ie: the - to _ conversion did occur during wheel generation but pex fails to take this into account when doing script searches.

@jsirois
Copy link
Member

jsirois commented Oct 12, 2018

Noting this is a dup of #443

jsirois added a commit to jsirois/pex that referenced this issue Oct 12, 2018
We had approximately the right handling of wheel name components in the
same file but were not leveraging common code. Robustify name component
handling, leverage and add tests.

Fixes pex-tool#443
Fixes pex-tool#551
jsirois added a commit to jsirois/pex that referenced this issue Oct 15, 2018
We had approximately the right handling of wheel name components in the
same file but were not leveraging common code. Robustify name component
handling, leverage and add tests.

Fixes pex-tool#443
Fixes pex-tool#551
jsirois added a commit that referenced this issue Oct 15, 2018
We had approximately the right handling of wheel name components in the
same file but were not leveraging common code. Robustify name component
handling, leverage and add tests.

Fixes #443
Fixes #551
@jsirois jsirois mentioned this issue Oct 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants