benley / bazel_rules_pex

Python PEX rules for Bazel
Apache License 2.0
39 stars 36 forks source link

pex_binary: Support PEXes with no entry points (interpreters) #62

Open evanj opened 6 years ago

evanj commented 6 years ago

When using pex without any entry points, it creates a PEX that is an interpreter that uses the bundled environment. This can be useful to distribute in order to execute other scripts.

interpreter_only_test.py: Verify that the PEX starts an interpreter.

Fixes the following Skylark exceptions in pex_binary:

File ".../bazel_rules_pex/examples/BUILD", line 24
  pex_binary(name = 'interpreter_only')
File ".../bazel_rules_pex/pex/pex_rules.bzl", line 177, in _pex_binary_impl
  pex_file_types.filter(ctx.files.srcs)[0]
index out of range (index is 0, but sequence has 0 elements)

File ".../bazel_rules_pex/examples/BUILD", line 24
  pex_binary(name = 'interpreter_only')
File ".../bazel_rules_pex/pex/pex_rules.bzl", line 225, in _pex_binary_impl
  main_pkg
name 'main_pkg' is not defined
evanj commented 6 years ago

This will unfortunately conflict with #61 . If you merge one of them, I'll happily fix the merge/rebase conflicts on the other for you. Thanks!