[PATCH v3 2/5] patman: Don't look at sys.argv when parsing settings

Douglas Anderson dianders at chromium.org
Thu Jul 7 17:23:50 CEST 2022


If you call the parser and tell it to parse but don't pass arguments
in then it will default to looking at sys.argv. This isn't really what
was intended and seems to have some side effects. Let's not do it.

NOTE: to see some of the side effects, note that this patch breaks
"patman -c1" if you don't have the patch ("patman: Fix implicit
command inserting") before it.

Signed-off-by: Douglas Anderson <dianders at chromium.org>
Tested-by: Brian Norris <briannorris at chromium.org>
Reviewed-by: Brian Norris <briannorris at chromium.org>
Reviewed-by: Simon Glass <sjg at chromium.org>
---

Changes in v3:
- Rebased atop ("patman: Fix defaults not propagating to subparsers")

 tools/patman/settings.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/patman/settings.py b/tools/patman/settings.py
index 4c847fe88fd4..6c5f6c8ed992 100644
--- a/tools/patman/settings.py
+++ b/tools/patman/settings.py
@@ -248,7 +248,7 @@ def _UpdateDefaults(main_parser, config):
     defaults = {}
     parser_defaults = []
     for parser in parsers:
-        pdefs = parser.parse_known_args()[0]
+        pdefs = parser.parse_known_args([])[0]
         parser_defaults.append(pdefs)
         defaults.update(vars(pdefs))
 
-- 
2.37.0.rc0.161.g10f37bed90-goog



More information about the U-Boot mailing list