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

pex -c does not work for multiplatform pexes when the target dist is platform specific #537

Closed
jsirois opened this issue Aug 15, 2018 · 0 comments
Assignees
Labels

Comments

@jsirois
Copy link
Member

jsirois commented Aug 15, 2018

If the console script is housed in a dist that is platform-specific and the pex is multiplatform, then the same script is found more than once and pex creation fails with something like:

RuntimeError: Ambiguous script specification pants matches multiple entry points:pants = pants.bin.pants_loader:main pants = pants.bin.pants_loader:main

Pex should probably allow dups from a single requirement key if the found scripts are bytewise identical as they are in this example case.

See pantsbuild/pants#6349 for an example of getting bit by this.

@jsirois jsirois added the bug label Aug 15, 2018
@jsirois jsirois mentioned this issue Aug 24, 2018
jsirois added a commit to jsirois/pex that referenced this issue Aug 25, 2018
jsirois added a commit to jsirois/pex that referenced this issue Aug 25, 2018
@jsirois jsirois self-assigned this Aug 26, 2018
jsirois added a commit that referenced this issue Aug 28, 2018
* Support -c for plat spec dists in multiplat pexes.

Fixes #537
benjyw pushed a commit to benjyw/pex that referenced this issue Nov 30, 2018
This PR adds a new CLI option, -p or --preamble-file, that is used to provide a preamble to the pex builder object.

We use pex via its API in the internal build tooling at NerdWallet (👋, we're neighbors!). We've been leveraging it for multi-platform support, but now that pex-tool#394 / 1.2.9 has landed the only thing missing from the CLI that we leverage is the preamble in the builder, which was pretty easy to hook up. Once this PR has landed we can remove all of the API integration and just rely on the pex CLI!

The CLI option and the PEXBuilder preamble functionality are covered by tests.

Local functional testing:

(pex-foo) 
evanborgstrom@evanborgstrom /tmp/preamble — u:34 j:1 (21:49:54 08.16)
pex-tool#536 ❯❯❯ echo 'print "foo!"' > preamble
(pex-foo) 
evanborgstrom@evanborgstrom /tmp/preamble — u:34 j:1 (21:50:11 08.16)
pex-tool#537 ❯❯❯ pex -p preamble 
foo!
Python 2.7.13 (default, Jun  7 2017, 11:02:53) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> 
(pex-foo) 
evanborgstrom@evanborgstrom /tmp/preamble — u:34 j:1 (21:50:18 08.16)
pex-tool#538 ❯❯❯ pex 
Python 2.7.13 (default, Jun  7 2017, 11:02:53) 
[GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.38)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>>
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

1 participant