|
50 | 50 | if __name__ == '__main__':
|
51 | 51 | # Parse Options
|
52 | 52 | parser = get_default_options_parser()
|
53 |
| - parser.add_option("-p", |
54 |
| - type="int", |
| 53 | + parser.add_argument("-p", |
| 54 | + type=int, |
55 | 55 | dest="program",
|
56 | 56 | help="The index of the desired test program: [0-%d]" % (len(TESTS)-1))
|
57 | 57 |
|
58 |
| - parser.add_option("-n", |
| 58 | + parser.add_argument("-n", |
59 | 59 | dest="program_name",
|
60 | 60 | help="The name of the desired test program")
|
61 | 61 |
|
62 |
| - parser.add_option("-j", "--jobs", |
63 |
| - type="int", |
| 62 | + parser.add_argument("-j", "--jobs", |
| 63 | + type=int, |
64 | 64 | dest="jobs",
|
65 | 65 | default=0,
|
66 | 66 | help="Number of concurrent jobs. Default: 0/auto (based on host machine's number of CPUs)")
|
67 | 67 |
|
68 |
| - parser.add_option("-v", "--verbose", |
| 68 | + parser.add_argument("-v", "--verbose", |
69 | 69 | action="store_true",
|
70 | 70 | dest="verbose",
|
71 | 71 | default=False,
|
72 | 72 | help="Verbose diagnostic output")
|
73 | 73 |
|
74 |
| - parser.add_option("--silent", |
| 74 | + parser.add_argument("--silent", |
75 | 75 | action="store_true",
|
76 | 76 | dest="silent",
|
77 | 77 | default=False,
|
78 | 78 | help="Silent diagnostic output (no copy, compile notification)")
|
79 | 79 |
|
80 |
| - parser.add_option("-D", "", |
| 80 | + parser.add_argument("-D", |
81 | 81 | action="append",
|
82 | 82 | dest="macros",
|
83 | 83 | help="Add a macro definition")
|
84 | 84 |
|
85 |
| - parser.add_option("-S", "--supported-toolchains", |
| 85 | + parser.add_argument("-S", "--supported-toolchains", |
86 | 86 | action="store_true",
|
87 | 87 | dest="supported_toolchains",
|
88 | 88 | default=False,
|
89 | 89 | help="Displays supported matrix of MCUs and toolchains")
|
90 | 90 |
|
91 |
| - parser.add_option('-f', '--filter', |
| 91 | + parser.add_argument('-f', '--filter', |
92 | 92 | dest='general_filter_regex',
|
93 | 93 | default=None,
|
94 | 94 | help='For some commands you can use filter to filter out results')
|
95 | 95 |
|
96 | 96 | # Local run
|
97 |
| - parser.add_option("--automated", action="store_true", dest="automated", |
| 97 | + parser.add_argument("--automated", action="store_true", dest="automated", |
98 | 98 | default=False, help="Automated test")
|
99 |
| - parser.add_option("--host", dest="host_test", |
| 99 | + parser.add_argument("--host", dest="host_test", |
100 | 100 | default=None, help="Host test")
|
101 |
| - parser.add_option("--extra", dest="extra", |
| 101 | + parser.add_argument("--extra", dest="extra", |
102 | 102 | default=None, help="Extra files")
|
103 |
| - parser.add_option("--peripherals", dest="peripherals", |
| 103 | + parser.add_argument("--peripherals", dest="peripherals", |
104 | 104 | default=None, help="Required peripherals")
|
105 |
| - parser.add_option("--dep", dest="dependencies", |
| 105 | + parser.add_argument("--dep", dest="dependencies", |
106 | 106 | default=None, help="Dependencies")
|
107 |
| - parser.add_option("--source", dest="source_dir", |
| 107 | + parser.add_argument("--source", dest="source_dir", |
108 | 108 | default=None, help="The source (input) directory", action="append")
|
109 |
| - parser.add_option("--duration", type="int", dest="duration", |
| 109 | + parser.add_argument("--duration", type=int, dest="duration", |
110 | 110 | default=None, help="Duration of the test")
|
111 |
| - parser.add_option("--build", dest="build_dir", |
| 111 | + parser.add_argument("--build", dest="build_dir", |
112 | 112 | default=None, help="The build (output) directory")
|
113 |
| - parser.add_option("-N", "--artifact-name", dest="artifact_name", |
| 113 | + parser.add_argument("-N", "--artifact-name", dest="artifact_name", |
114 | 114 | default=None, help="The built project's name")
|
115 |
| - parser.add_option("-d", "--disk", dest="disk", |
| 115 | + parser.add_argument("-d", "--disk", dest="disk", |
116 | 116 | default=None, help="The mbed disk")
|
117 |
| - parser.add_option("-s", "--serial", dest="serial", |
| 117 | + parser.add_argument("-s", "--serial", dest="serial", |
118 | 118 | default=None, help="The mbed serial port")
|
119 |
| - parser.add_option("-b", "--baud", type="int", dest="baud", |
| 119 | + parser.add_argument("-b", "--baud", type=int, dest="baud", |
120 | 120 | default=None, help="The mbed serial baud rate")
|
121 |
| - parser.add_option("-L", "--list-tests", action="store_true", dest="list_tests", |
| 121 | + parser.add_argument("-L", "--list-tests", action="store_true", dest="list_tests", |
122 | 122 | default=False, help="List available tests in order and exit")
|
123 | 123 |
|
124 | 124 | # Ideally, all the tests with a single "main" thread can be run with, or
|
125 | 125 | # without the rtos, eth, usb_host, usb, dsp, fat, ublox
|
126 |
| - parser.add_option("--rtos", |
| 126 | + parser.add_argument("--rtos", |
127 | 127 | action="store_true", dest="rtos",
|
128 | 128 | default=False, help="Link with RTOS library")
|
129 | 129 |
|
130 |
| - parser.add_option("--rpc", |
| 130 | + parser.add_argument("--rpc", |
131 | 131 | action="store_true", dest="rpc",
|
132 | 132 | default=False, help="Link with RPC library")
|
133 | 133 |
|
134 |
| - parser.add_option("--eth", |
| 134 | + parser.add_argument("--eth", |
135 | 135 | action="store_true", dest="eth",
|
136 | 136 | default=False,
|
137 | 137 | help="Link with Ethernet library")
|
138 | 138 |
|
139 |
| - parser.add_option("--usb_host", |
| 139 | + parser.add_argument("--usb_host", |
140 | 140 | action="store_true",
|
141 | 141 | dest="usb_host",
|
142 | 142 | default=False,
|
143 | 143 | help="Link with USB Host library")
|
144 | 144 |
|
145 |
| - parser.add_option("--usb", |
| 145 | + parser.add_argument("--usb", |
146 | 146 | action="store_true",
|
147 | 147 | dest="usb",
|
148 | 148 | default=False,
|
149 | 149 | help="Link with USB Device library")
|
150 | 150 |
|
151 |
| - parser.add_option("--dsp", |
| 151 | + parser.add_argument("--dsp", |
152 | 152 | action="store_true",
|
153 | 153 | dest="dsp",
|
154 | 154 | default=False,
|
155 | 155 | help="Link with DSP library")
|
156 | 156 |
|
157 |
| - parser.add_option("--fat", |
| 157 | + parser.add_argument("--fat", |
158 | 158 | action="store_true",
|
159 | 159 | dest="fat",
|
160 | 160 | default=False,
|
161 | 161 | help="Link with FS ad SD card file system library")
|
162 | 162 |
|
163 |
| - parser.add_option("--ublox", |
| 163 | + parser.add_argument("--ublox", |
164 | 164 | action="store_true",
|
165 | 165 | dest="ublox",
|
166 | 166 | default=False,
|
167 | 167 | help="Link with U-Blox library")
|
168 | 168 |
|
169 |
| - parser.add_option("--testlib", |
| 169 | + parser.add_argument("--testlib", |
170 | 170 | action="store_true",
|
171 | 171 | dest="testlib",
|
172 | 172 | default=False,
|
173 | 173 | help="Link with mbed test library")
|
174 | 174 |
|
175 | 175 | # Specify a different linker script
|
176 |
| - parser.add_option("-l", "--linker", dest="linker_script", |
| 176 | + parser.add_argument("-l", "--linker", dest="linker_script", |
177 | 177 | default=None, help="use the specified linker script")
|
178 | 178 |
|
179 |
| - (options, args) = parser.parse_args() |
| 179 | + options = parser.parse_args() |
180 | 180 |
|
181 | 181 | # Only prints matrix of supported toolchains
|
182 | 182 | if options.supported_toolchains:
|
|
0 commit comments