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

How to use --pex-args in bdist_pex #233

Closed
salimfadhley opened this issue Apr 14, 2016 · 7 comments
Closed

How to use --pex-args in bdist_pex #233

salimfadhley opened this issue Apr 14, 2016 · 7 comments
Assignees
Labels

Comments

@salimfadhley
Copy link

I'm trying to use bdist_pex. I want to ensure that I use a different Python for the shebang. I can tell that this syntax is not working. Please could you point me to the correct usage of --pex-args?

[me@computer src]$ ../venv/bin/python ./setup.py bdist_pex --bdist-dir=../build --pex-args='--python-shebang=/efs/dist/python/core/2.7.9/exec/bin/python --find-links=../dep/wheelhouse'
running bdist_pex
Writing logging_server to ../build/logging_server-0.0.1.pex
[me@computer src]$ head -1 ../build/logging_server-0.0.1.pex
#!/usr/bin/env python2.7
[me@computer src]$
@jsirois
Copy link
Member

jsirois commented Apr 14, 2016

Try pex --help-variables and using env vars and report back.

@salimfadhley
Copy link
Author

@jsirois, thanks for responsing to my question so quickly!

Are you suggesting that I look at the variables as an alternative to passing in the values through the command line? The one I'm after is a variable that's equivalent to --python-shebang.

This command prints out a lovely list of variables:

../venv/bin/python ./setup.py bdist_pex --bdist-dir=../build --pex-args --help-variables

So one might conclude that any argument or option that follows --pex-args gets captured by the pex command (instead of being treated a setup-tools argument), however that would imply the following command should work:

[me@computer src]$ rm -rf ../build
[me@computer src]$ ../venv/bin/python ./setup.py bdist_pex --bdist-dir=../build --pex-args --python-shebang=/efs/dist/python/core/2.7.9/exec/bin/python --pex-args --find-links=../dep/wheelhouse
running bdist_pex
Writing logging_server to ../build/logging_server-0.0.1.pex
[me@computer src]$ head -1 ../build/logging_server-0.0.1.pex
#!/usr/bin/env python2.7

@jsirois
Copy link
Member

jsirois commented Apr 14, 2016

Turns out PEXBuilder.clone is broken, which bdist_pex uses and pex does not. I'll have a PR to fix this shortly.

@jsirois
Copy link
Member

jsirois commented Apr 19, 2016

Fix is in @ 2fc3f73

@pikeas
Copy link
Contributor

pikeas commented Apr 20, 2016

Other pex args also fail when passed via pex-args, including -v. A direct invocation of --pex-args='-v' works, but pex-args = '-v' in [bdist_pex] fails. Ditto -r requirements.txt and --platform linux-x86_64.

It looks like these are all being parsed as requirements instead of options. I'm running a clone from master which includes this fix.

@jsirois
Copy link
Member

jsirois commented Apr 20, 2016

@pikeas - mind filing a seperate issue? I don't replicate your experience with a quick test:

$ pex --version
pex 1.1.4
$ python setup.py bdist_pex 
running bdist_pex
Writing pex to /home/jsirois/dev/pantsbuild/pex/dist/pex-1.1.4.pex
$ python setup.py bdist_pex --pex-args='-vvv'
running bdist_pex
pex: Resolving interpreter: 0.6ms                                                                                   
pex:   Setting up interpreter /home/jsirois/.pyenv/versions/2.7.11/envs/scratch/bin/python2.7: 0.6ms
pex: Installing /tmp/tmpVpfJ46: 365.3ms
pex: crawling link i=0 link=Link('file:///home/jsirois/.pex/build') follow_links=False                                                     
pex: crawling link i=0 link=Link('https://pypi.python.org/simple/setuptools/') follow_links=False
pex: Resolving distributions: 788.3ms                                                                                                                                                         
pex:   Fetching file:///tmp/tmpVpfJ46/pex-1.1.4.tar.gz: 0.6ms
pex:     Fetching file:///tmp/tmpVpfJ46/pex-1.1.4.tar.gz: 0.4ms
pex:   Translating /tmp/tmpoNlwIn/pex-1.1.4.tar.gz into distribution: 135.8ms
pex:     Packaging pex: 119.8ms
pex:       Installing /tmp/tmprMrroE: 118.1ms
pex:   Fetching file:///home/jsirois/.pex/build/setuptools-19.7-py2.py3-none-any.whl: 0.7ms
pex:     Fetching file:///home/jsirois/.pex/build/setuptools-19.7-py2.py3-none-any.whl: 0.4ms
pex:   Translating /tmp/tmpRM6241/setuptools-19.7-py2.py3-none-any.whl into distribution: 1.1ms
  pex 1.1.4
  setuptools 19.7
Writing pex to /home/jsirois/dev/pantsbuild/pex/dist/pex-1.1.4.pex

@jsirois
Copy link
Member

jsirois commented Apr 20, 2016

I read too quickly, you mention what looks like an ini-file section of some sort ([bdist_pex]). But again - please file a seperate detailed issue.

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

3 participants