#1540 Constrain the matrix of shebang, platforms and ICs as much as possible.
Issue created by
jsirois
Building and booting a PEX can involve the interplay of 4 concepts currently:
1. The interpreter(s) the Pex CLI is run with.
2. The platforms specified.
3. The interpreter constraints specified.
4. The shebang the resulting PEX file is built with.
These all need to be in alignment to produce a PEX that "boots" properly. Further, they need to be particular beyond that in order to squeeze performance out of some combinations of those items.
Pex cannot ensure alignment, let along maximally performing alignment, in all cases. It can probably catch a few out-of-aligment cases though and - preferably - automatically bring them in alignment, or - less preferably - warn or potential issues. For the latter, care will be needed not to provided unwanted nannying for a knowledgeable user or a too sharp knife (the current situation) for the casual user.
An example of automated alignment would be basing the default shebang for a single --platform PEX, or else multiplatform PEX where all platforms share the same major / minor versions in their platform tag, off that major / minor version pair. I.E.: for
--platform linux-x86_64-cp-37-cp37m --platform macosx-10.13-x86_64-cp-37-m
use a default shebang of
#!/usr/bin/env python3.7
. This is in contrast to the behavior today, which is the shebang defaulting to
#!/usr/bin/env pythonX.Y
where X / Y are the major / minor versions of the interpreter used to run the Pex CLI, and which need bear no relation to the platforms selected.
The answer to what can be and should be constrained will change once
#1020 is implemented, but even shy of that the status quo can be improved to prevent this style of unambiguous mis-aligment.
pantsbuild/pex