diff options
author | Simon Glass <sjg@chromium.org> | 2020-07-05 21:41:53 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2020-07-24 19:25:15 -0600 |
commit | fda1e372d35dc956317923f5057c3ac83be7f571 (patch) | |
tree | c019d16ce2ec2346ccf55d80b50304f5ae396f21 /tools/patman/settings.py | |
parent | 137947e05b25a9e511bbc30bd795c9d95deec0cb (diff) |
patman: Convert to ArgumentParser
Convert from OptionParser to ArgumentParser to match binman. With this we
can easily add sub-commands.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/patman/settings.py')
-rw-r--r-- | tools/patman/settings.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tools/patman/settings.py b/tools/patman/settings.py index 635561ac05..732bd40106 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -233,17 +233,19 @@ def _UpdateDefaults(parser, config): config: An instance of _ProjectConfigParser that we will query for settings. """ - defaults = parser.get_default_values() + defaults = parser.parse_known_args()[0] + defaults = vars(defaults) for name, val in config.items('settings'): - if hasattr(defaults, name): - default_val = getattr(defaults, name) + if name in defaults: + default_val = defaults[name] if isinstance(default_val, bool): val = config.getboolean('settings', name) elif isinstance(default_val, int): val = config.getint('settings', name) - parser.set_default(name, val) + defaults[name] = val else: print("WARNING: Unknown setting %s" % name) + parser.set_defaults(**defaults) def _ReadAliasFile(fname): """Read in the U-Boot git alias file if it exists. |