diff options
author | Sean Anderson <sean.anderson@seco.com> | 2022-04-29 10:53:34 -0400 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-06-28 03:09:51 +0100 |
commit | 4780f7d8a6b2f479884d4e6068a73d1a69f82d4d (patch) | |
tree | 7716b000f08f08106f5ec88eb5ebf1aa39dfaf7b /tools/patman | |
parent | d3eb1bf7cf242440c966ff20114abbe7f94c4a46 (diff) | |
download | u-boot-4780f7d8a6b2f479884d4e6068a73d1a69f82d4d.zip u-boot-4780f7d8a6b2f479884d4e6068a73d1a69f82d4d.tar.gz u-boot-4780f7d8a6b2f479884d4e6068a73d1a69f82d4d.tar.bz2 |
patman: Fix defaults not propagating to subparsers
On python 3.8.10 (and 3.10), subparsers are not updated with defaults. I
suspect this is related to [1]. Fix this by explicitly updating
subparsers with settings.
[1] https://github.com/python/cpython/issues/89398
Fixes: 3145b63513 ("patman: Update defaults in subparsers")
Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Tested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Diffstat (limited to 'tools/patman')
-rw-r--r-- | tools/patman/settings.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/patman/settings.py b/tools/patman/settings.py index 7c2b5c1..4c847fe 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -246,8 +246,10 @@ def _UpdateDefaults(main_parser, config): # Collect the defaults from each parser defaults = {} + parser_defaults = [] for parser in parsers: pdefs = parser.parse_known_args()[0] + parser_defaults.append(pdefs) defaults.update(vars(pdefs)) # Go through the settings and collect defaults @@ -264,8 +266,11 @@ def _UpdateDefaults(main_parser, config): else: print("WARNING: Unknown setting %s" % name) - # Set all the defaults (this propagates through all subparsers) + # Set all the defaults and manually propagate them to subparsers main_parser.set_defaults(**defaults) + for parser, pdefs in zip(parsers, parser_defaults): + parser.set_defaults(**{ k: v for k, v in defaults.items() + if k in pdefs }) def _ReadAliasFile(fname): """Read in the U-Boot git alias file if it exists. |