-
Notifications
You must be signed in to change notification settings - Fork 3k
[tools] Prevent trace-backs from incomplete args #2393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,14 +207,20 @@ | |
|
||
# Target | ||
if options.mcu is None : | ||
args_error(parser, "[ERROR] You should specify an MCU") | ||
args_error(parser, "argument -m/--mcu is required") | ||
mcu = options.mcu[0] | ||
|
||
# Toolchain | ||
if options.tool is None: | ||
args_error(parser, "[ERROR] You should specify a TOOLCHAIN") | ||
args_error(parser, "argument -t/--tool is required") | ||
toolchain = options.tool[0] | ||
|
||
if (options.program is None) and (not options.source_dir): | ||
args_error(parser, "one of -p, -n, or --source is required") | ||
|
||
if options.source_dir and not options.build_dir: | ||
args_error(parser, "argument --build is required when argument --source is provided") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this corrrect? Do we really require the user to specify a build dir if he specifies one or more source dirs? Feels a bit weird. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, We do. I agree, it does feel a bit weird. If you don't specify a build directory, you get a traceback about None not having startswith, I think. |
||
|
||
if options.color: | ||
# This import happens late to prevent initializing colorization when we don't need it | ||
import colorize | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,12 +107,12 @@ | |
|
||
# Target | ||
if options.mcu is None : | ||
args_error(parser, "[ERROR] You should specify an MCU") | ||
args_error(parser, "argument -m/--mcu is required") | ||
mcu = options.mcu[0] | ||
|
||
# Toolchain | ||
if options.tool is None: | ||
args_error(parser, "[ERROR] You should specify a TOOLCHAIN") | ||
args_error(parser, "argument -t/--tool is required") | ||
toolchain = options.tool[0] | ||
|
||
# Find all tests in the relevant paths | ||
|
@@ -152,8 +152,7 @@ | |
else: | ||
# Build all tests | ||
if not options.build_dir: | ||
print "[ERROR] You must specify a build path" | ||
sys.exit(1) | ||
args_error(parser, "argument --build is required") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This used return code 1 on exit, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This used return code 1 on exit, but There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Considering that we don't have a guide on return codes of the tools, They are on shaky ground if they check return codes. I agree that technically this is a breaking change. |
||
|
||
base_source_paths = options.source_dir | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove
[ERROR]
? wasn't that an intention warning/error/etc ? Does this PR clean all [ERROR] messages ?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
args_error
already prints an error message.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's obvious from the outputs you shared but it changes from
[ERROR]
tocommand: error:
. I am not aware though how was that used (if there any tool that was parsing this or was just an unification of messages we print to have a format. That was my concern, looks fine to me as it is now ;)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that makes sense. Thanks for the clarification. I only changed things that were "argument errors".