-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pex_binary: Support PEXes with no entry points (interpreters)
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
- Loading branch information
Evan Jones
committed
Jan 8, 2018
1 parent
bde25c1
commit 901dae9
Showing
3 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/usr/bin/env python2.7 | ||
|
||
import sys | ||
import subprocess | ||
|
||
def main(): | ||
if len(sys.argv) != 2: | ||
sys.stderr.write('Error: Pass path to an interpreter pex\n') | ||
sys.exit(1) | ||
interpreter_pex_path = sys.argv[1] | ||
|
||
output = subprocess.check_output([interpreter_pex_path], stderr=subprocess.STDOUT) | ||
assert 'InteractiveConsole' in output | ||
print 'PASS' | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters