Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Commit

Permalink
Pex without interpreter cache disabled (#1167)
Browse files Browse the repository at this point in the history
  • Loading branch information
objmagic authored Jul 27, 2016
1 parent 2a91bc4 commit ad12ca3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions third_party/pex/_pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def main():
parser = optparse.OptionParser(usage="usage: %prog [options] output")
parser.add_option('--entry-point', default='__main__')
parser.add_option('--no-pypi', action='store_false', dest='pypi', default=True)
parser.add_option('--disable-cache', action='store_true', dest='disable_cache', default=False)
parser.add_option('--not-zip-safe', action='store_false', dest='zip_safe', default=True)
parser.add_option('--python', default="/usr/bin/python2.7")
parser.add_option('--find-links', dest='find_links', default='')
Expand Down Expand Up @@ -128,6 +129,8 @@ def main():
poptions.pypi = options.pypi
poptions.python = options.python
poptions.zip_safe = options.zip_safe
poptions.disable_cache = options.disable_cache


print("pex options: %s" % poptions)
os.environ["PATH"] = ".:%s:/bin:/usr/bin" % poptions.python
Expand Down
9 changes: 6 additions & 3 deletions tools/rules/pex_rules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def make_manifest(ctx, output):
command = ('touch %s && echo "%s" > %s' % (output.path, manifest_text, output.path)))

def common_pex_arguments(entry_point, deploy_pex_path, manifest_file_path):
arguments = ['--entry-point', entry_point]
arguments = ['--disable-cache']
arguments += ['--entry-point', entry_point]

# Our internal build environment requires extra args injected and this is a brutal hack. Ideally
# bazel would provide a mechanism to swap in env-specific global params here
Expand Down Expand Up @@ -129,7 +130,7 @@ def pex_binary_impl(ctx):
pexbuilder = ctx.executable._pexbuilder

# form the arguments to pex builder
arguments = [] if ctx.attr.zip_safe else ["--not-zip-safe"]
arguments = [] if ctx.attr.zip_safe else ["--not-zip-safe"]
arguments += common_pex_arguments(main_pkg, deploy_pex.path, manifest_file.path)

# form the inputs to pex builder
Expand Down Expand Up @@ -169,12 +170,14 @@ def pex_test_impl(ctx):
pex_test_files = pex_test_file_types.filter(pex_file_types.filter(transitive_sources))
test_run_args = ' '.join([f.path for f in pex_test_files])

arguments = common_pex_arguments('pytest', deploy_pex.path, manifest_file.path)

ctx.action(
inputs = [manifest_file] + list(transitive_sources) + list(transitive_eggs) + list(transitive_resources),
executable = pexbuilder,
outputs = [ deploy_pex ],
mnemonic = "PexPython",
arguments = common_pex_arguments('pytest', deploy_pex.path, manifest_file.path))
arguments = arguments)

executable = ctx.outputs.executable
ctx.action(
Expand Down

0 comments on commit ad12ca3

Please sign in to comment.