| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2017 The LUCI Authors. All rights reserved. | 2 # Copyright 2017 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
| 4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import argparse | 6 import argparse |
| 7 import logging | 7 import logging |
| 8 import os | 8 import os |
| 9 import subprocess | 9 import subprocess |
| 10 import sys | 10 import sys |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 vpython_path = os.path.join(cipd_root, 'vpython' + EXE_EXTENSION) | 51 vpython_path = os.path.join(cipd_root, 'vpython' + EXE_EXTENSION) |
| 52 if not os.path.isfile(vpython_path): | 52 if not os.path.isfile(vpython_path): |
| 53 raise ValueError('`vpython` not found at [%s]' % (vpython_path,)) | 53 raise ValueError('`vpython` not found at [%s]' % (vpython_path,)) |
| 54 return vpython_path | 54 return vpython_path |
| 55 | 55 |
| 56 | 56 |
| 57 def main(args): | 57 def main(args): |
| 58 parser = argparse.ArgumentParser() | 58 parser = argparse.ArgumentParser() |
| 59 parser.add_argument('--venv-spec', metavar='PATH', | 59 parser.add_argument('--venv-spec', metavar='PATH', |
| 60 default=os.path.join(ROOT, 'bootstrap', 'venv.cfg'), | 60 default=os.path.join(ROOT, 'bootstrap', 'venv.cfg'), |
| 61 help='Path to vpython enviornment specification file to use (default ' | 61 help='Path to vpython environment specification file to use (default ' |
| 62 'is %(default)s).') | 62 'is %(default)s).') |
| 63 parser.add_argument('--vpython-path', metavar='PATH', | 63 parser.add_argument('--vpython-path', metavar='PATH', |
| 64 help='Use "vpython" binary at PATH, instead of the bootstrap default.') | 64 help='Use "vpython" binary at PATH, instead of the bootstrap default.') |
| 65 parser.add_argument('-v', '--verbose', action='count', default=0, | 65 parser.add_argument('-v', '--verbose', action='count', default=0, |
| 66 help='Increase verbosity. Can be specified multiple times.') | 66 help='Increase verbosity. Can be specified multiple times.') |
| 67 parser.add_argument('--presubmit', action='store_true', | 67 parser.add_argument('--presubmit', action='store_true', |
| 68 help='Run PRESUBMIT check and exit, zero on success, non-zero on ' | 68 help='Run PRESUBMIT check and exit, zero on success, non-zero on ' |
| 69 'failure.') | 69 'failure.') |
| 70 parser.add_argument('args', nargs='*', | 70 parser.add_argument('args', nargs='*', |
| 71 help='Flags and arguments to pass to the target Python script.') | 71 help='Flags and arguments to pass to the target Python script.') |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 return subprocess.call(vpython_args) | 98 return subprocess.call(vpython_args) |
| 99 | 99 |
| 100 vpython_args += ['--'] + opts.args | 100 vpython_args += ['--'] + opts.args |
| 101 LOGGER.debug('Executing bootstrapped Python: %s', vpython_args) | 101 LOGGER.debug('Executing bootstrapped Python: %s', vpython_args) |
| 102 return subprocess.call(vpython_args) | 102 return subprocess.call(vpython_args) |
| 103 | 103 |
| 104 | 104 |
| 105 if __name__ == '__main__': | 105 if __name__ == '__main__': |
| 106 logging.basicConfig() | 106 logging.basicConfig() |
| 107 sys.exit(main(sys.argv[1:])) | 107 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |