You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mbed/mbed.py
+53-45Lines changed: 53 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -43,9 +43,8 @@
43
43
importerrno
44
44
importctypes
45
45
fromitertoolsimportchain, repeat
46
-
importargparse
47
-
importtempfile
48
46
importzipfile
47
+
importargparse
49
48
50
49
51
50
# Application version
@@ -168,14 +167,18 @@ def action(msg):
168
167
log(message(line))
169
168
170
169
defwarning(msg):
171
-
forlineinmsg.splitlines():
172
-
sys.stderr.write("[mbed] WARNING: %s\n"%line)
173
-
sys.stderr.write("---\n")
170
+
lines=msg.splitlines()
171
+
log(message("WARNING: %s"%lines.pop(0)))
172
+
forlineinlines:
173
+
log(" %s\n"%line)
174
+
log("---\n")
174
175
175
176
deferror(msg, code=-1):
176
-
forlineinmsg.splitlines():
177
-
sys.stderr.write("[mbed] ERROR: %s\n"%line)
178
-
sys.stderr.write("---\n")
177
+
lines=msg.splitlines()
178
+
log(message("ERROR: %s"%lines.pop(0)))
179
+
forlineinlines:
180
+
log(" %s\n"%line)
181
+
log("---\n")
179
182
sys.exit(code)
180
183
181
184
defoffline_warning(offline, top=True):
@@ -217,15 +220,15 @@ class ProcessException(Exception):
217
220
218
221
defpopen(command, stdin=None, **kwargs):
219
222
# print for debugging
220
-
info('Exec "'+' '.join(command)+'" in '+getcwd())
223
+
info("Exec \"%s\" in \"%s\""% (' '.join(command), getcwd()))
221
224
proc=None
222
225
try:
223
226
proc=subprocess.Popen(command, **kwargs)
224
227
exceptOSErrorase:
225
228
ife.args[0] ==errno.ENOENT:
226
229
error(
227
-
"Could not execute \"%s\".\n"
228
-
"Please verify that it's installed and accessible from your current path by executing \"%s\".\n"% (command[0], command[0]), e.args[0])
230
+
"Could not execute \"%s\" in \"%s\".\n"
231
+
"You can verify that it's installed and accessible from your current path by executing \"%s\".\n"% (' '.join(command), getcwd(), command[0]), e.args[0])
"Please verify that it's installed and accessible from your current path by executing \"%s\".\n"% (command[0], command[0]), e.args[0])
246
+
"Could not execute \"%s\" in \"%s\".\n"
247
+
"You can verify that it's installed and accessible from your current path by executing \"%s\".\n"% (' '.join(command), getcwd(), command[0]), e.args[0])
except(ValueError): # relative import fails on Python 2 in non-package mode
1792
+
frommbed_terminalimportMbedTerminal
1788
1793
except (IOError, ImportError, OSError):
1789
1794
error("The serial terminal functionality requires that the 'mbed-terminal' python module is installed.\nYou can install mbed-terminal by running 'pip install mbed-terminal'.", 1)
description="Command-line code management tool for ARM mbed OS - http://www.mbed.com\nversion %s\n\nUse 'mbed <command> -h|--help' for detailed help.\nOnline manual and guide available at https://github.com/ARMmbed/mbed-cli"%ver,
1816
+
description="Command-line code management tool for ARM mbed OS - http://www.mbed.com\nversion %s\n\nUse \"mbed <command> -h|--help\" for detailed help.\nOnline manual and guide available at https://github.com/ARMmbed/mbed-cli"%ver,
error("The '-f/--flash' option requires that the 'mbed-greentea' python module is installed.\nYou can install mbed-greentea by running 'pip install mbed-greentea'.", 1)
2540
+
error("The '-f/--flash' option requires that the 'mbed-greentea' python module is installed.\nYou can install mbed-greentea by running \"%s -m pip install mbed-greentea\"."%python_cmd, 1)
dict(name=['--profile'], action='append', help='Path of a build profile configuration file. Example: mbed-os/tools/profiles/debug.json'),
2565
2570
dict(name=['-c', '--clean'], action='store_true', help='Clean the build directory before compiling'),
2566
2571
dict(name='--test-spec', dest="test_spec", help="Path used for the test spec file used when building and running tests (the default path is the build directory)"),
2567
-
dict(name='--app-config', dest="app_config", help="Path of an app configuration file (Default is to look for 'mbed_app.json')"),
2572
+
dict(name='--app-config', dest="app_config", help="Path of an application configuration file. Default is to look for \"mbed_app.json\""),
2568
2573
dict(name='--test-config', dest="test_config", help="Path or mbed OS keyword of a test configuration file. Example: ethernet, odin_wifi, or path/to/config.json"),
2569
2574
help='Find, build and run tests',
2570
2575
description="Find, build, and run tests in a program and libraries")
"Could not find mbed program in current path \"%s\".\n"
2854
-
"Change the current directory to a valid mbed program, set the current directory as an mbed program with 'mbed config root .', or use the '--global' option to set global configuration."%program.path)
2859
+
"Change the current directory to a valid mbed program, set the current directory as an mbed program with \"mbed config root .\", or use the '--global' option to set global configuration."%program.path)
0 commit comments