|
14 | 14 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | 15 | See the License for the specific language governing permissions and
|
16 | 16 | limitations under the License.
|
17 |
| -
|
18 |
| -
|
19 |
| -TEST BUILD & RUN |
20 | 17 | """
|
21 | 18 | import sys
|
22 | 19 | import os
|
23 |
| -import json |
24 | 20 |
|
25 | 21 | ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
26 | 22 | sys.path.insert(0, ROOT)
|
27 | 23 |
|
28 |
| - |
29 | 24 | from tools.options import get_default_options_parser
|
30 | 25 |
|
31 | 26 | # Check: Extra modules which are required by core test suite
|
|
37 | 32 | from tools.test_api import get_autodetected_MUTS_list
|
38 | 33 |
|
39 | 34 |
|
40 |
| -if __name__ == '__main__': |
| 35 | +def main(): |
| 36 | + """Entry Point""" |
41 | 37 | try:
|
42 | 38 | # Parse Options
|
43 | 39 | parser = get_default_options_parser()
|
44 | 40 |
|
45 | 41 | parser.add_argument("-S", "--supported-toolchains",
|
46 |
| - action="store_true", |
47 |
| - dest="supported_toolchains", |
48 |
| - default=False, |
49 |
| - help="Displays supported matrix of targets and toolchains") |
| 42 | + action="store_true", |
| 43 | + dest="supported_toolchains", |
| 44 | + default=False, |
| 45 | + help="Displays supported matrix of" |
| 46 | + " targets and toolchains") |
50 | 47 |
|
51 | 48 | parser.add_argument('-f', '--filter',
|
52 |
| - dest='general_filter_regex', |
53 |
| - default=None, |
54 |
| - help='Filter targets') |
| 49 | + dest='general_filter_regex', |
| 50 | + default=None, |
| 51 | + help='Filter targets') |
55 | 52 |
|
56 | 53 | parser.add_argument("-v", "--verbose",
|
57 |
| - action="store_true", |
58 |
| - dest="verbose", |
59 |
| - default=False, |
60 |
| - help="Verbose diagnostic output") |
| 54 | + action="store_true", |
| 55 | + dest="verbose", |
| 56 | + default=False, |
| 57 | + help="Verbose diagnostic output") |
61 | 58 |
|
62 | 59 | options = parser.parse_args()
|
63 | 60 |
|
64 | 61 | # Only prints matrix of supported toolchains
|
65 | 62 | if options.supported_toolchains:
|
66 |
| - print mcu_toolchain_matrix(platform_filter=options.general_filter_regex) |
| 63 | + print mcu_toolchain_matrix( |
| 64 | + platform_filter=options.general_filter_regex) |
67 | 65 | exit(0)
|
68 | 66 |
|
69 | 67 | # If auto_detect attribute is present, we assume other auto-detection
|
70 | 68 | # parameters like 'toolchains_filter' are also set.
|
71 |
| - MUTs = get_autodetected_MUTS_list() |
| 69 | + muts = get_autodetected_MUTS_list() |
72 | 70 |
|
73 | 71 | count = 0
|
74 |
| - for mut in MUTs.values(): |
| 72 | + for mut in muts.values(): |
75 | 73 | print ""
|
76 |
| - print "[mbed] Detected %s, port %s, mounted %s" % (mut['mcu'], mut['port'], mut['disk']) |
| 74 | + print "[mbed] Detected %s, port %s, mounted %s" % \ |
| 75 | + (mut['mcu'], mut['port'], mut['disk']) |
77 | 76 | print "[mbed] Supported toolchains for %s" % mut['mcu']
|
78 | 77 | print mcu_toolchain_matrix(platform_filter=r'^'+mut['mcu']+'$')
|
79 | 78 | count += 1
|
80 |
| - |
| 79 | + |
81 | 80 | if count == 0:
|
82 | 81 | print "[mbed] No mbed targets where detected on your system."
|
83 | 82 |
|
84 |
| - except KeyboardInterrupt, e: |
| 83 | + except KeyboardInterrupt: |
85 | 84 | print "\n[CTRL+c] exit"
|
86 |
| - except Exception,e: |
| 85 | + except Exception as exc: |
87 | 86 | import traceback
|
88 | 87 | traceback.print_exc(file=sys.stdout)
|
89 |
| - print "[ERROR] %s" % str(e) |
| 88 | + print "[ERROR] %s" % str(exc) |
90 | 89 | sys.exit(1)
|
| 90 | + |
| 91 | +if __name__ == '__main__': |
| 92 | + main() |
0 commit comments