https://pantsbuild.org/ logo
#pex
Title
# pex
w

witty-crayon-22786

07/15/2020, 5:13 PM
@happy-kitchen-89482, @hundreds-father-404: re the
python
vs
python3
issue
a bash script would work. but if all we’re doing is using the bash script to launch pex, it might be possible to encode a better shebang line in the pex.
h

hundreds-father-404

07/15/2020, 5:16 PM
Shebangs don’t allow for multiple binary names, right? It’s only
python
or
python3
, not
python | python3
?
w

witty-crayon-22786

07/15/2020, 5:17 PM
sec
checking.
h

hundreds-father-404

07/15/2020, 5:17 PM
I’ve run into this issue multiple times with scripts, where I want to express “this can use >=3.6”. I either have to settle for
python3
and gamble that <3.6 isn’t used; or put
python3.6
, but then no newer Pythons can use the script Idk if Pex has a more clever shebang mechanism
w

witty-crayon-22786

07/15/2020, 5:18 PM
i think the issue is that the shebang mechanism is built into the kernel, so it doesn’t run under a shell
👍 1
so… one way or another it would need to be a bash script, i think.
👍 1
h

hundreds-father-404

07/15/2020, 5:19 PM
i think the issue is that the shebang mechanism is built into the kernel
Huh, is it really? TIL
w

witty-crayon-22786

07/15/2020, 5:21 PM
i wonder if pex could do this though:
Copy code
$ cat blah.sh
#!/usr/bin/env bash
echo "Running a file that contains some garbage on the end..."
exit 0

dskhsdlajljdssd
$ ./blah.sh
Running a file that contains some garbage on the end...
ie, bootstrap with bash, then include some bash code to locate a python
👍 1
it’s certainly easier to just wrap this in bash from the pants side though.
👍 1
it also relates to the cluster of issues around https://github.com/pantsbuild/pants/issues/9760 though.
on a host by host basis, you might want configuration for this. we could choose reasonable defaults for local host since we’re running there, but you might need different values for a remote host.
i’ll follow up on this one. but if one of you is able to look at the lambdaex issue, it would be appreciated.