-
Notifications
You must be signed in to change notification settings - Fork 3k
Generalize flag handling #1976
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
Merged
Merged
Generalize flag handling #1976
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f442fd9
Broaden acceptable toolchain spec; improved incorrect toolchain error
theotherjimmy ee8a02c
Generalize export format flag input
theotherjimmy 52a7f64
Generalize parsing types
theotherjimmy 43e036d
Move to argparse from optparse
theotherjimmy b98c8c1
Generalize all appropriate arguments and check for file existance
theotherjimmy e4c6bcd
Move test parsers to tests.py
theotherjimmy c5ac2cf
Create type combinator many
theotherjimmy 18868ff
Convert project.py to the new style of argument parsing
theotherjimmy 2fc4d64
Brought test_api.py and users into the new order of argument parsing
theotherjimmy 91c45a7
Improve test -n and -p failure messages
theotherjimmy c969a4c
Better test completion and everything that can be is columnated
theotherjimmy 053efc6
Add -S, -L, and --source to the mutually exclusive group
theotherjimmy 439d2e8
Add -S, -L, and --source to the project.py mutually exclusive group
theotherjimmy 3276854
fix parse error in test.py and make -n + -p comma separated
theotherjimmy 7e5deaa
standardize on nargs="*"
theotherjimmy d757f35
Update style
theotherjimmy 7b3ef21
Make mcu and tool arguments many and update all consumers of them
theotherjimmy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
from tools.options import get_default_options_parser | ||
from tools.build_api import get_config | ||
from config import Config | ||
from utils import argparse_filestring_type | ||
try: | ||
import tools.private_settings as ps | ||
except: | ||
|
@@ -36,19 +37,15 @@ | |
if __name__ == '__main__': | ||
# Parse Options | ||
parser = get_default_options_parser(add_clean=False, add_options=False) | ||
parser.add_option("--source", dest="source_dir", | ||
default=None, help="The source (input) directory", action="append") | ||
parser.add_option("--prefix", dest="prefix", action="append", | ||
default=None, help="Restrict listing to parameters that have this prefix") | ||
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", | ||
parser.add_argument("--source", dest="source_dir", type=argparse_filestring_type, | ||
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. If a
@bogdanm Does it ever make sense to run this script without the |
||
default=[], help="The source (input) directory", nargs="*") | ||
parser.add_argument("--prefix", dest="prefix", nargs="*", | ||
default=[], help="Restrict listing to parameters that have this prefix") | ||
parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", | ||
default=False, help="Verbose diagnostic output") | ||
|
||
(options, args) = parser.parse_args() | ||
options = parser.parse_args() | ||
|
||
for path in options.source_dir : | ||
if not isdir(path) : | ||
args_error(parser, "[ERROR] you passed \"{}\" to --source, which does not exist". | ||
format(path)) | ||
# Target | ||
if options.mcu is None : | ||
args_error(parser, "[ERROR] You should specify an MCU") | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This call is pulling in the following unneeded options:
-m
,-t
,-c <--clean
, and-o <--options>
. Perhaps this should just be a new instantiation of argparse?This should probably be in a separate PR though.
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.
Can you add a PR to fix this @bridadan ?