| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2012 The LUCI Authors. All rights reserved. | 2 # Copyright 2012 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 """Runs a command with optional isolated input/output. | 6 """Runs a command with optional isolated input/output. |
| 7 | 7 |
| 8 Despite name "run_isolated", can run a generic non-isolated command specified as | 8 Despite name "run_isolated", can run a generic non-isolated command specified as |
| 9 args. | 9 args. |
| 10 | 10 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 # unsupported and probably unneeded. | 110 # unsupported and probably unneeded. |
| 111 assert not zip_package.is_zipped_module(sys.modules[__name__]) | 111 assert not zip_package.is_zipped_module(sys.modules[__name__]) |
| 112 assert THIS_FILE_PATH | 112 assert THIS_FILE_PATH |
| 113 assert BASE_DIR | 113 assert BASE_DIR |
| 114 package = zip_package.ZipPackage(root=BASE_DIR) | 114 package = zip_package.ZipPackage(root=BASE_DIR) |
| 115 package.add_python_file(THIS_FILE_PATH, '__main__.py' if executable else None) | 115 package.add_python_file(THIS_FILE_PATH, '__main__.py' if executable else None) |
| 116 package.add_python_file(os.path.join(BASE_DIR, 'isolated_format.py')) | 116 package.add_python_file(os.path.join(BASE_DIR, 'isolated_format.py')) |
| 117 package.add_python_file(os.path.join(BASE_DIR, 'isolateserver.py')) | 117 package.add_python_file(os.path.join(BASE_DIR, 'isolateserver.py')) |
| 118 package.add_python_file(os.path.join(BASE_DIR, 'auth.py')) | 118 package.add_python_file(os.path.join(BASE_DIR, 'auth.py')) |
| 119 package.add_python_file(os.path.join(BASE_DIR, 'cipd.py')) | 119 package.add_python_file(os.path.join(BASE_DIR, 'cipd.py')) |
| 120 package.add_directory(os.path.join(BASE_DIR, 'libs')) |
| 120 package.add_directory(os.path.join(BASE_DIR, 'third_party')) | 121 package.add_directory(os.path.join(BASE_DIR, 'third_party')) |
| 121 package.add_directory(os.path.join(BASE_DIR, 'utils')) | 122 package.add_directory(os.path.join(BASE_DIR, 'utils')) |
| 122 return package | 123 return package |
| 123 | 124 |
| 124 | 125 |
| 125 def make_temp_dir(prefix, root_dir): | 126 def make_temp_dir(prefix, root_dir): |
| 126 """Returns a new unique temporary directory.""" | 127 """Returns a new unique temporary directory.""" |
| 127 return unicode(tempfile.mkdtemp(prefix=prefix, dir=root_dir)) | 128 return unicode(tempfile.mkdtemp(prefix=prefix, dir=root_dir)) |
| 128 | 129 |
| 129 | 130 |
| (...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 print >> sys.stderr, ex.message | 770 print >> sys.stderr, ex.message |
| 770 return 1 | 771 return 1 |
| 771 | 772 |
| 772 | 773 |
| 773 if __name__ == '__main__': | 774 if __name__ == '__main__': |
| 774 subprocess42.inhibit_os_error_reporting() | 775 subprocess42.inhibit_os_error_reporting() |
| 775 # Ensure that we are always running with the correct encoding. | 776 # Ensure that we are always running with the correct encoding. |
| 776 fix_encoding.fix_encoding() | 777 fix_encoding.fix_encoding() |
| 777 file_path.enable_symlink() | 778 file_path.enable_symlink() |
| 778 sys.exit(main(sys.argv[1:])) | 779 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |