OLD | NEW |
1 # Copyright 2014 The Swarming Authors. All rights reserved. | 1 # Copyright 2014 The Swarming Authors. All rights reserved. |
2 # Use of this source code is governed by the Apache v2.0 license that can be | 2 # Use of this source code is governed by the Apache v2.0 license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Runs either task_runner.py, bot_main.py or bot_config.py. | 5 """Runs either task_runner.py, bot_main.py or bot_config.py. |
6 | 6 |
7 The imports are done late so if an ImportError occurs, it is localized to this | 7 The imports are done late so if an ImportError occurs, it is localized to this |
8 command only. | 8 command only. |
9 """ | 9 """ |
10 | 10 |
11 __version__ = '0.3' | 11 __version__ = '0.3' |
12 | 12 |
13 import json | 13 import json |
14 import logging | 14 import logging |
15 import os | 15 import os |
16 import optparse | 16 import optparse |
17 import shutil | 17 import shutil |
18 import subprocess | 18 import subprocess |
19 import sys | 19 import sys |
20 import zipfile | 20 import zipfile |
21 | 21 |
22 import logging_utils | 22 from utils import logging_utils |
23 from utils import zip_package | 23 from utils import zip_package |
24 | 24 |
25 # This file can only be run as a zip. | 25 # This file can only be run as a zip. |
26 THIS_FILE = os.path.abspath(zip_package.get_main_script_path()) | 26 THIS_FILE = os.path.abspath(zip_package.get_main_script_path()) |
27 | 27 |
28 | 28 |
29 # TODO(maruel): Use depot_tools/subcommand.py. The goal here is to have all the | 29 # TODO(maruel): Use depot_tools/subcommand.py. The goal here is to have all the |
30 # sub commands packed into the single .zip file as a swiss army knife (think | 30 # sub commands packed into the single .zip file as a swiss army knife (think |
31 # busybox but worse). | 31 # busybox but worse). |
32 | 32 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 with zipfile.ZipFile(THIS_FILE, 'r') as f: | 160 with zipfile.ZipFile(THIS_FILE, 'r') as f: |
161 logging.error('Files in %s:\n%s', THIS_FILE, f.namelist()) | 161 logging.error('Files in %s:\n%s', THIS_FILE, f.namelist()) |
162 return 1 | 162 return 1 |
163 | 163 |
164 print >> sys.stderr, 'Unknown command %s' % cmd | 164 print >> sys.stderr, 'Unknown command %s' % cmd |
165 return 1 | 165 return 1 |
166 | 166 |
167 | 167 |
168 if __name__ == '__main__': | 168 if __name__ == '__main__': |
169 sys.exit(main()) | 169 sys.exit(main()) |
OLD | NEW |