patman: Fix error when the email blacklist is missing
PATCH 1/1 patman: Fix error when the email blacklist is missing
This section of the settings file may be missing. Handle that gracefully rather than emitting an error.
Also update patman to write this section when a new settings file is created.
---
tools/patman/settings.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)
tools/patman/settings.py +25 -3
@@ -212,7 +212,12 @@ def CreatePatmanConfigFile(config_fname): print("Couldn't create patman config file\n") raise - print("[alias]\nme: %s <%s>" % (name, email), file=f) + print('''[alias] +me: %s <%s> + +[bounces] +nxp = Zhikang Zhang <[email protected]> +''' % (name, email), file=f) f.close(); def _UpdateDefaults(parser, config):
@@ -282,6 +287,23 @@ def _ReadBouncesFile(fname): continue bounces.add(line.strip()) +def GetItems(config, section): + """Get the items from a section of the config. + + Args: + config: _ProjectConfigParser object containing settings + section: name of section to retrieve + + Returns: + List of (name, value) tuples for the section + """ + try: + return config.items(section) + except ConfigParser.NoSectionError as e: + return [] + except: + raise + def Setup(parser, project_name, config_fname=''): """Set up the settings module by reading config files.
@@ -303,11 +325,11 @@ def Setup(parser, project_name, config_fname=''): config.read(config_fname) - for name, value in config.items('alias'): + for name, value in GetItems(config, 'alias'): alias[name] = value.split(',') _ReadBouncesFile('doc/bounces') - for name, value in config.items('bounces'): + for name, value in GetItems(config, 'bounces'): bounces.add(value) _UpdateDefaults(parser, config)
Signature · 1 line
2.14.1.581.gf28d330327-goog
PATCH 1/1 patman: Fix error when the email blacklist is missing
Quoted 11 lines · Simon Glass
This section of the settings file may be missing. Handle that gracefully rather than emitting an error.
Also update patman to write this section when a new settings file is created.
Fixes e11aa602 (patman: add support for omitting bouncing addresses)Signed-off-by Simon Glass <[email protected]>---
Quoted 62 lines
tools/patman/settings.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-)tools/patman/settings.py +25
-4@@ -212,7 +212,12 @@ def CreatePatmanConfigFile(config_fname): print("Couldn't create patman config file\n") raise - print("[alias]\nme: %s <%s>" % (name, email), file=f) + print('''[alias] +me: %s <%s> + +[bounces] +nxp = Zhikang Zhang <[email protected]> +''' % (name, email), file=f) f.close(); def _UpdateDefaults(parser, config):@@ -282,6 +287,23 @@ def _ReadBouncesFile(fname): continue bounces.add(line.strip()) +def GetItems(config, section): + """Get the items from a section of the config. + + Args: + config: _ProjectConfigParser object containing settings + section: name of section to retrieve + + Returns: + List of (name, value) tuples for the section + """ + try: + return config.items(section) + except ConfigParser.NoSectionError as e: + return [] + except: + raise + def Setup(parser, project_name, config_fname=''): """Set up the settings module by reading config files.@@ -303,11 +325,11 @@ def Setup(parser, project_name, config_fname=''): config.read(config_fname) - for name, value in config.items('alias'): + for name, value in GetItems(config, 'alias'): alias[name] = value.split(',') _ReadBouncesFile('doc/bounces') - for name, value in config.items('bounces'): + for name, value in GetItems(config, 'bounces'): bounces.add(value) _UpdateDefaults(parser, config) --2.14.1.581.gf28d330327-goog
PATCH 1/1 patman: Fix error when the email blacklist is missing
Quoted 7 lines · Chris Packham
Quoted 6 lines · Simon Glass
This section of the settings file may be missing. Handle that gracefully rather than emitting an error.
Also update patman to write this section when a new settings file is created.
Quoted 8 lines
Quoted 5 lines
Fixes e11aa602 (patman: add support for omitting bouncing addresses)Signed-off-by Simon Glass <[email protected]>---
Reviewed-by Chris Packham <[email protected]>
PATCH 1/1 patman: Fix error when the email blacklist is missing
Quoted 10 lines · Bin Meng
Quoted 9 lines · Chris Packham
Quoted 8 lines · Simon Glass
This section of the settings file may be missing. Handle that gracefully rather than emitting an error.
Also update patman to write this section when a new settings file is created.
Fixes e11aa602 (patman: add support for omitting bouncing addresses)
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Signed-off-by Simon Glass <[email protected]>---
Reviewed-by Chris Packham <[email protected]>Tested-by Bin Meng <[email protected]>
Applied to u-boot-dm