Clone of official tools
make.py@0:66f3b5499f7f, 2016-05-19 (annotated)
- Committer:
- screamer
- Date:
- Thu May 19 19:44:41 2016 +0100
- Revision:
- 0:66f3b5499f7f
- Child:
- 9:2d27d77ada5c
Initial revision
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
screamer | 0:66f3b5499f7f | 1 | #! /usr/bin/env python2 |
screamer | 0:66f3b5499f7f | 2 | """ |
screamer | 0:66f3b5499f7f | 3 | mbed SDK |
screamer | 0:66f3b5499f7f | 4 | Copyright (c) 2011-2013 ARM Limited |
screamer | 0:66f3b5499f7f | 5 | |
screamer | 0:66f3b5499f7f | 6 | Licensed under the Apache License, Version 2.0 (the "License"); |
screamer | 0:66f3b5499f7f | 7 | you may not use this file except in compliance with the License. |
screamer | 0:66f3b5499f7f | 8 | You may obtain a copy of the License at |
screamer | 0:66f3b5499f7f | 9 | |
screamer | 0:66f3b5499f7f | 10 | http://www.apache.org/licenses/LICENSE-2.0 |
screamer | 0:66f3b5499f7f | 11 | |
screamer | 0:66f3b5499f7f | 12 | Unless required by applicable law or agreed to in writing, software |
screamer | 0:66f3b5499f7f | 13 | distributed under the License is distributed on an "AS IS" BASIS, |
screamer | 0:66f3b5499f7f | 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
screamer | 0:66f3b5499f7f | 15 | See the License for the specific language governing permissions and |
screamer | 0:66f3b5499f7f | 16 | limitations under the License. |
screamer | 0:66f3b5499f7f | 17 | |
screamer | 0:66f3b5499f7f | 18 | |
screamer | 0:66f3b5499f7f | 19 | TEST BUILD & RUN |
screamer | 0:66f3b5499f7f | 20 | """ |
screamer | 0:66f3b5499f7f | 21 | import sys |
screamer | 0:66f3b5499f7f | 22 | from time import sleep |
screamer | 0:66f3b5499f7f | 23 | from shutil import copy |
screamer | 0:66f3b5499f7f | 24 | from os.path import join, abspath, dirname |
screamer | 0:66f3b5499f7f | 25 | |
screamer | 0:66f3b5499f7f | 26 | # Be sure that the tools directory is in the search path |
screamer | 0:66f3b5499f7f | 27 | ROOT = abspath(join(dirname(__file__), "..")) |
screamer | 0:66f3b5499f7f | 28 | sys.path.insert(0, ROOT) |
screamer | 0:66f3b5499f7f | 29 | |
screamer | 0:66f3b5499f7f | 30 | from tools.utils import args_error |
screamer | 0:66f3b5499f7f | 31 | from tools.paths import BUILD_DIR |
screamer | 0:66f3b5499f7f | 32 | from tools.paths import RTOS_LIBRARIES |
screamer | 0:66f3b5499f7f | 33 | from tools.paths import RPC_LIBRARY |
screamer | 0:66f3b5499f7f | 34 | from tools.paths import ETH_LIBRARY |
screamer | 0:66f3b5499f7f | 35 | from tools.paths import USB_HOST_LIBRARIES, USB_LIBRARIES |
screamer | 0:66f3b5499f7f | 36 | from tools.paths import DSP_LIBRARIES |
screamer | 0:66f3b5499f7f | 37 | from tools.paths import FS_LIBRARY |
screamer | 0:66f3b5499f7f | 38 | from tools.paths import UBLOX_LIBRARY |
screamer | 0:66f3b5499f7f | 39 | from tools.tests import TESTS, Test, TEST_MAP |
screamer | 0:66f3b5499f7f | 40 | from tools.tests import TEST_MBED_LIB |
screamer | 0:66f3b5499f7f | 41 | from tools.targets import TARGET_MAP |
screamer | 0:66f3b5499f7f | 42 | from tools.options import get_default_options_parser |
screamer | 0:66f3b5499f7f | 43 | from tools.build_api import build_project |
screamer | 0:66f3b5499f7f | 44 | try: |
screamer | 0:66f3b5499f7f | 45 | import tools.private_settings as ps |
screamer | 0:66f3b5499f7f | 46 | except: |
screamer | 0:66f3b5499f7f | 47 | ps = object() |
screamer | 0:66f3b5499f7f | 48 | |
screamer | 0:66f3b5499f7f | 49 | |
screamer | 0:66f3b5499f7f | 50 | if __name__ == '__main__': |
screamer | 0:66f3b5499f7f | 51 | # Parse Options |
screamer | 0:66f3b5499f7f | 52 | parser = get_default_options_parser() |
screamer | 0:66f3b5499f7f | 53 | parser.add_option("-p", |
screamer | 0:66f3b5499f7f | 54 | type="int", |
screamer | 0:66f3b5499f7f | 55 | dest="program", |
screamer | 0:66f3b5499f7f | 56 | help="The index of the desired test program: [0-%d]" % (len(TESTS)-1)) |
screamer | 0:66f3b5499f7f | 57 | |
screamer | 0:66f3b5499f7f | 58 | parser.add_option("-n", |
screamer | 0:66f3b5499f7f | 59 | dest="program_name", |
screamer | 0:66f3b5499f7f | 60 | help="The name of the desired test program") |
screamer | 0:66f3b5499f7f | 61 | |
screamer | 0:66f3b5499f7f | 62 | parser.add_option("-j", "--jobs", |
screamer | 0:66f3b5499f7f | 63 | type="int", |
screamer | 0:66f3b5499f7f | 64 | dest="jobs", |
screamer | 0:66f3b5499f7f | 65 | default=0, |
screamer | 0:66f3b5499f7f | 66 | help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)") |
screamer | 0:66f3b5499f7f | 67 | |
screamer | 0:66f3b5499f7f | 68 | parser.add_option("-v", "--verbose", |
screamer | 0:66f3b5499f7f | 69 | action="store_true", |
screamer | 0:66f3b5499f7f | 70 | dest="verbose", |
screamer | 0:66f3b5499f7f | 71 | default=False, |
screamer | 0:66f3b5499f7f | 72 | help="Verbose diagnostic output") |
screamer | 0:66f3b5499f7f | 73 | |
screamer | 0:66f3b5499f7f | 74 | parser.add_option("--silent", |
screamer | 0:66f3b5499f7f | 75 | action="store_true", |
screamer | 0:66f3b5499f7f | 76 | dest="silent", |
screamer | 0:66f3b5499f7f | 77 | default=False, |
screamer | 0:66f3b5499f7f | 78 | help="Silent diagnostic output (no copy, compile notification)") |
screamer | 0:66f3b5499f7f | 79 | |
screamer | 0:66f3b5499f7f | 80 | parser.add_option("-D", "", |
screamer | 0:66f3b5499f7f | 81 | action="append", |
screamer | 0:66f3b5499f7f | 82 | dest="macros", |
screamer | 0:66f3b5499f7f | 83 | help="Add a macro definition") |
screamer | 0:66f3b5499f7f | 84 | |
screamer | 0:66f3b5499f7f | 85 | # Local run |
screamer | 0:66f3b5499f7f | 86 | parser.add_option("--automated", action="store_true", dest="automated", |
screamer | 0:66f3b5499f7f | 87 | default=False, help="Automated test") |
screamer | 0:66f3b5499f7f | 88 | parser.add_option("--host", dest="host_test", |
screamer | 0:66f3b5499f7f | 89 | default=None, help="Host test") |
screamer | 0:66f3b5499f7f | 90 | parser.add_option("--extra", dest="extra", |
screamer | 0:66f3b5499f7f | 91 | default=None, help="Extra files") |
screamer | 0:66f3b5499f7f | 92 | parser.add_option("--peripherals", dest="peripherals", |
screamer | 0:66f3b5499f7f | 93 | default=None, help="Required peripherals") |
screamer | 0:66f3b5499f7f | 94 | parser.add_option("--dep", dest="dependencies", |
screamer | 0:66f3b5499f7f | 95 | default=None, help="Dependencies") |
screamer | 0:66f3b5499f7f | 96 | parser.add_option("--source", dest="source_dir", |
screamer | 0:66f3b5499f7f | 97 | default=None, help="The source (input) directory", action="append") |
screamer | 0:66f3b5499f7f | 98 | parser.add_option("--duration", type="int", dest="duration", |
screamer | 0:66f3b5499f7f | 99 | default=None, help="Duration of the test") |
screamer | 0:66f3b5499f7f | 100 | parser.add_option("--build", dest="build_dir", |
screamer | 0:66f3b5499f7f | 101 | default=None, help="The build (output) directory") |
screamer | 0:66f3b5499f7f | 102 | parser.add_option("-N", "--artifact-name", dest="artifact_name", |
screamer | 0:66f3b5499f7f | 103 | default=None, help="The built project's name") |
screamer | 0:66f3b5499f7f | 104 | parser.add_option("-d", "--disk", dest="disk", |
screamer | 0:66f3b5499f7f | 105 | default=None, help="The mbed disk") |
screamer | 0:66f3b5499f7f | 106 | parser.add_option("-s", "--serial", dest="serial", |
screamer | 0:66f3b5499f7f | 107 | default=None, help="The mbed serial port") |
screamer | 0:66f3b5499f7f | 108 | parser.add_option("-b", "--baud", type="int", dest="baud", |
screamer | 0:66f3b5499f7f | 109 | default=None, help="The mbed serial baud rate") |
screamer | 0:66f3b5499f7f | 110 | parser.add_option("-L", "--list-tests", action="store_true", dest="list_tests", |
screamer | 0:66f3b5499f7f | 111 | default=False, help="List available tests in order and exit") |
screamer | 0:66f3b5499f7f | 112 | |
screamer | 0:66f3b5499f7f | 113 | # Ideally, all the tests with a single "main" thread can be run with, or |
screamer | 0:66f3b5499f7f | 114 | # without the rtos, eth, usb_host, usb, dsp, fat, ublox |
screamer | 0:66f3b5499f7f | 115 | parser.add_option("--rtos", |
screamer | 0:66f3b5499f7f | 116 | action="store_true", dest="rtos", |
screamer | 0:66f3b5499f7f | 117 | default=False, help="Link with RTOS library") |
screamer | 0:66f3b5499f7f | 118 | |
screamer | 0:66f3b5499f7f | 119 | parser.add_option("--rpc", |
screamer | 0:66f3b5499f7f | 120 | action="store_true", dest="rpc", |
screamer | 0:66f3b5499f7f | 121 | default=False, help="Link with RPC library") |
screamer | 0:66f3b5499f7f | 122 | |
screamer | 0:66f3b5499f7f | 123 | parser.add_option("--eth", |
screamer | 0:66f3b5499f7f | 124 | action="store_true", dest="eth", |
screamer | 0:66f3b5499f7f | 125 | default=False, |
screamer | 0:66f3b5499f7f | 126 | help="Link with Ethernet library") |
screamer | 0:66f3b5499f7f | 127 | |
screamer | 0:66f3b5499f7f | 128 | parser.add_option("--usb_host", |
screamer | 0:66f3b5499f7f | 129 | action="store_true", |
screamer | 0:66f3b5499f7f | 130 | dest="usb_host", |
screamer | 0:66f3b5499f7f | 131 | default=False, |
screamer | 0:66f3b5499f7f | 132 | help="Link with USB Host library") |
screamer | 0:66f3b5499f7f | 133 | |
screamer | 0:66f3b5499f7f | 134 | parser.add_option("--usb", |
screamer | 0:66f3b5499f7f | 135 | action="store_true", |
screamer | 0:66f3b5499f7f | 136 | dest="usb", |
screamer | 0:66f3b5499f7f | 137 | default=False, |
screamer | 0:66f3b5499f7f | 138 | help="Link with USB Device library") |
screamer | 0:66f3b5499f7f | 139 | |
screamer | 0:66f3b5499f7f | 140 | parser.add_option("--dsp", |
screamer | 0:66f3b5499f7f | 141 | action="store_true", |
screamer | 0:66f3b5499f7f | 142 | dest="dsp", |
screamer | 0:66f3b5499f7f | 143 | default=False, |
screamer | 0:66f3b5499f7f | 144 | help="Link with DSP library") |
screamer | 0:66f3b5499f7f | 145 | |
screamer | 0:66f3b5499f7f | 146 | parser.add_option("--fat", |
screamer | 0:66f3b5499f7f | 147 | action="store_true", |
screamer | 0:66f3b5499f7f | 148 | dest="fat", |
screamer | 0:66f3b5499f7f | 149 | default=False, |
screamer | 0:66f3b5499f7f | 150 | help="Link with FS ad SD card file system library") |
screamer | 0:66f3b5499f7f | 151 | |
screamer | 0:66f3b5499f7f | 152 | parser.add_option("--ublox", |
screamer | 0:66f3b5499f7f | 153 | action="store_true", |
screamer | 0:66f3b5499f7f | 154 | dest="ublox", |
screamer | 0:66f3b5499f7f | 155 | default=False, |
screamer | 0:66f3b5499f7f | 156 | help="Link with U-Blox library") |
screamer | 0:66f3b5499f7f | 157 | |
screamer | 0:66f3b5499f7f | 158 | parser.add_option("--testlib", |
screamer | 0:66f3b5499f7f | 159 | action="store_true", |
screamer | 0:66f3b5499f7f | 160 | dest="testlib", |
screamer | 0:66f3b5499f7f | 161 | default=False, |
screamer | 0:66f3b5499f7f | 162 | help="Link with mbed test library") |
screamer | 0:66f3b5499f7f | 163 | |
screamer | 0:66f3b5499f7f | 164 | # Specify a different linker script |
screamer | 0:66f3b5499f7f | 165 | parser.add_option("-l", "--linker", dest="linker_script", |
screamer | 0:66f3b5499f7f | 166 | default=None, help="use the specified linker script") |
screamer | 0:66f3b5499f7f | 167 | |
screamer | 0:66f3b5499f7f | 168 | (options, args) = parser.parse_args() |
screamer | 0:66f3b5499f7f | 169 | |
screamer | 0:66f3b5499f7f | 170 | # Print available tests in order and exit |
screamer | 0:66f3b5499f7f | 171 | if options.list_tests is True: |
screamer | 0:66f3b5499f7f | 172 | print '\n'.join(map(str, sorted(TEST_MAP.values()))) |
screamer | 0:66f3b5499f7f | 173 | sys.exit() |
screamer | 0:66f3b5499f7f | 174 | |
screamer | 0:66f3b5499f7f | 175 | # force program to "0" if a source dir is specified |
screamer | 0:66f3b5499f7f | 176 | if options.source_dir is not None: |
screamer | 0:66f3b5499f7f | 177 | p = 0 |
screamer | 0:66f3b5499f7f | 178 | n = None |
screamer | 0:66f3b5499f7f | 179 | else: |
screamer | 0:66f3b5499f7f | 180 | # Program Number or name |
screamer | 0:66f3b5499f7f | 181 | p, n = options.program, options.program_name |
screamer | 0:66f3b5499f7f | 182 | |
screamer | 0:66f3b5499f7f | 183 | if n is not None and p is not None: |
screamer | 0:66f3b5499f7f | 184 | args_error(parser, "[ERROR] specify either '-n' or '-p', not both") |
screamer | 0:66f3b5499f7f | 185 | if n: |
screamer | 0:66f3b5499f7f | 186 | # We will transform 'n' to list of 'p' (integers which are test numbers) |
screamer | 0:66f3b5499f7f | 187 | nlist = n.split(',') |
screamer | 0:66f3b5499f7f | 188 | for test_id in nlist: |
screamer | 0:66f3b5499f7f | 189 | if test_id not in TEST_MAP.keys(): |
screamer | 0:66f3b5499f7f | 190 | args_error(parser, "[ERROR] Program with name '%s' not found"% test_id) |
screamer | 0:66f3b5499f7f | 191 | |
screamer | 0:66f3b5499f7f | 192 | p = [TEST_MAP[n].n for n in nlist] |
screamer | 0:66f3b5499f7f | 193 | elif p is None or (p < 0) or (p > (len(TESTS)-1)): |
screamer | 0:66f3b5499f7f | 194 | message = "[ERROR] You have to specify one of the following tests:\n" |
screamer | 0:66f3b5499f7f | 195 | message += '\n'.join(map(str, sorted(TEST_MAP.values()))) |
screamer | 0:66f3b5499f7f | 196 | args_error(parser, message) |
screamer | 0:66f3b5499f7f | 197 | |
screamer | 0:66f3b5499f7f | 198 | # If 'p' was set via -n to list of numbers make this a single element integer list |
screamer | 0:66f3b5499f7f | 199 | if type(p) != type([]): |
screamer | 0:66f3b5499f7f | 200 | p = [p] |
screamer | 0:66f3b5499f7f | 201 | |
screamer | 0:66f3b5499f7f | 202 | # Target |
screamer | 0:66f3b5499f7f | 203 | if options.mcu is None : |
screamer | 0:66f3b5499f7f | 204 | args_error(parser, "[ERROR] You should specify an MCU") |
screamer | 0:66f3b5499f7f | 205 | mcu = options.mcu |
screamer | 0:66f3b5499f7f | 206 | |
screamer | 0:66f3b5499f7f | 207 | # Toolchain |
screamer | 0:66f3b5499f7f | 208 | if options.tool is None: |
screamer | 0:66f3b5499f7f | 209 | args_error(parser, "[ERROR] You should specify a TOOLCHAIN") |
screamer | 0:66f3b5499f7f | 210 | toolchain = options.tool |
screamer | 0:66f3b5499f7f | 211 | |
screamer | 0:66f3b5499f7f | 212 | # Test |
screamer | 0:66f3b5499f7f | 213 | for test_no in p: |
screamer | 0:66f3b5499f7f | 214 | test = Test(test_no) |
screamer | 0:66f3b5499f7f | 215 | if options.automated is not None: test.automated = options.automated |
screamer | 0:66f3b5499f7f | 216 | if options.dependencies is not None: test.dependencies = options.dependencies |
screamer | 0:66f3b5499f7f | 217 | if options.host_test is not None: test.host_test = options.host_test; |
screamer | 0:66f3b5499f7f | 218 | if options.peripherals is not None: test.peripherals = options.peripherals; |
screamer | 0:66f3b5499f7f | 219 | if options.duration is not None: test.duration = options.duration; |
screamer | 0:66f3b5499f7f | 220 | if options.extra is not None: test.extra_files = options.extra |
screamer | 0:66f3b5499f7f | 221 | |
screamer | 0:66f3b5499f7f | 222 | if not test.is_supported(mcu, toolchain): |
screamer | 0:66f3b5499f7f | 223 | print 'The selected test is not supported on target %s with toolchain %s' % (mcu, toolchain) |
screamer | 0:66f3b5499f7f | 224 | sys.exit() |
screamer | 0:66f3b5499f7f | 225 | |
screamer | 0:66f3b5499f7f | 226 | # Linking with extra libraries |
screamer | 0:66f3b5499f7f | 227 | if options.rtos: test.dependencies.append(RTOS_LIBRARIES) |
screamer | 0:66f3b5499f7f | 228 | if options.rpc: test.dependencies.append(RPC_LIBRARY) |
screamer | 0:66f3b5499f7f | 229 | if options.eth: test.dependencies.append(ETH_LIBRARY) |
screamer | 0:66f3b5499f7f | 230 | if options.usb_host: test.dependencies.append(USB_HOST_LIBRARIES) |
screamer | 0:66f3b5499f7f | 231 | if options.usb: test.dependencies.append(USB_LIBRARIES) |
screamer | 0:66f3b5499f7f | 232 | if options.dsp: test.dependencies.append(DSP_LIBRARIES) |
screamer | 0:66f3b5499f7f | 233 | if options.fat: test.dependencies.append(FS_LIBRARY) |
screamer | 0:66f3b5499f7f | 234 | if options.ublox: test.dependencies.append(UBLOX_LIBRARY) |
screamer | 0:66f3b5499f7f | 235 | if options.testlib: test.dependencies.append(TEST_MBED_LIB) |
screamer | 0:66f3b5499f7f | 236 | |
screamer | 0:66f3b5499f7f | 237 | build_dir = join(BUILD_DIR, "test", mcu, toolchain, test.id) |
screamer | 0:66f3b5499f7f | 238 | if options.source_dir is not None: |
screamer | 0:66f3b5499f7f | 239 | test.source_dir = options.source_dir |
screamer | 0:66f3b5499f7f | 240 | build_dir = options.source_dir |
screamer | 0:66f3b5499f7f | 241 | |
screamer | 0:66f3b5499f7f | 242 | if options.build_dir is not None: |
screamer | 0:66f3b5499f7f | 243 | build_dir = options.build_dir |
screamer | 0:66f3b5499f7f | 244 | |
screamer | 0:66f3b5499f7f | 245 | try: |
screamer | 0:66f3b5499f7f | 246 | target = TARGET_MAP[mcu] |
screamer | 0:66f3b5499f7f | 247 | except KeyError: |
screamer | 0:66f3b5499f7f | 248 | print "[ERROR] Target %s not supported" % mcu |
screamer | 0:66f3b5499f7f | 249 | sys.exit(1) |
screamer | 0:66f3b5499f7f | 250 | |
screamer | 0:66f3b5499f7f | 251 | try: |
screamer | 0:66f3b5499f7f | 252 | bin_file = build_project(test.source_dir, build_dir, target, toolchain, test.dependencies, options.options, |
screamer | 0:66f3b5499f7f | 253 | linker_script=options.linker_script, |
screamer | 0:66f3b5499f7f | 254 | clean=options.clean, |
screamer | 0:66f3b5499f7f | 255 | verbose=options.verbose, |
screamer | 0:66f3b5499f7f | 256 | silent=options.silent, |
screamer | 0:66f3b5499f7f | 257 | macros=options.macros, |
screamer | 0:66f3b5499f7f | 258 | jobs=options.jobs, |
screamer | 0:66f3b5499f7f | 259 | name=options.artifact_name) |
screamer | 0:66f3b5499f7f | 260 | print 'Image: %s'% bin_file |
screamer | 0:66f3b5499f7f | 261 | |
screamer | 0:66f3b5499f7f | 262 | if options.disk: |
screamer | 0:66f3b5499f7f | 263 | # Simple copy to the mbed disk |
screamer | 0:66f3b5499f7f | 264 | copy(bin_file, options.disk) |
screamer | 0:66f3b5499f7f | 265 | |
screamer | 0:66f3b5499f7f | 266 | if options.serial: |
screamer | 0:66f3b5499f7f | 267 | # Import pyserial: https://pypi.python.org/pypi/pyserial |
screamer | 0:66f3b5499f7f | 268 | from serial import Serial |
screamer | 0:66f3b5499f7f | 269 | |
screamer | 0:66f3b5499f7f | 270 | sleep(target.program_cycle_s()) |
screamer | 0:66f3b5499f7f | 271 | |
screamer | 0:66f3b5499f7f | 272 | serial = Serial(options.serial, timeout = 1) |
screamer | 0:66f3b5499f7f | 273 | if options.baud: |
screamer | 0:66f3b5499f7f | 274 | serial.setBaudrate(options.baud) |
screamer | 0:66f3b5499f7f | 275 | |
screamer | 0:66f3b5499f7f | 276 | serial.flushInput() |
screamer | 0:66f3b5499f7f | 277 | serial.flushOutput() |
screamer | 0:66f3b5499f7f | 278 | |
screamer | 0:66f3b5499f7f | 279 | try: |
screamer | 0:66f3b5499f7f | 280 | serial.sendBreak() |
screamer | 0:66f3b5499f7f | 281 | except: |
screamer | 0:66f3b5499f7f | 282 | # In linux a termios.error is raised in sendBreak and in setBreak. |
screamer | 0:66f3b5499f7f | 283 | # The following setBreak() is needed to release the reset signal on the target mcu. |
screamer | 0:66f3b5499f7f | 284 | try: |
screamer | 0:66f3b5499f7f | 285 | serial.setBreak(False) |
screamer | 0:66f3b5499f7f | 286 | except: |
screamer | 0:66f3b5499f7f | 287 | pass |
screamer | 0:66f3b5499f7f | 288 | |
screamer | 0:66f3b5499f7f | 289 | while True: |
screamer | 0:66f3b5499f7f | 290 | c = serial.read(512) |
screamer | 0:66f3b5499f7f | 291 | sys.stdout.write(c) |
screamer | 0:66f3b5499f7f | 292 | sys.stdout.flush() |
screamer | 0:66f3b5499f7f | 293 | |
screamer | 0:66f3b5499f7f | 294 | except KeyboardInterrupt, e: |
screamer | 0:66f3b5499f7f | 295 | print "\n[CTRL+c] exit" |
screamer | 0:66f3b5499f7f | 296 | except Exception,e: |
screamer | 0:66f3b5499f7f | 297 | if options.verbose: |
screamer | 0:66f3b5499f7f | 298 | import traceback |
screamer | 0:66f3b5499f7f | 299 | traceback.print_exc(file=sys.stdout) |
screamer | 0:66f3b5499f7f | 300 | else: |
screamer | 0:66f3b5499f7f | 301 | print "[ERROR] %s" % str(e) |
screamer | 0:66f3b5499f7f | 302 | |
screamer | 0:66f3b5499f7f | 303 | sys.exit(1) |