diff options
author | Maxim Cournoyer <maxim.cournoyer@gmail.com> | 2022-12-20 00:38:40 -0500 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2023-01-05 19:21:57 -0700 |
commit | db16edd8ced27c06c075999ef95c6a1a57db98e0 (patch) | |
tree | 96f3532d7de11ee252bc3540225074d6d86fb0e1 | |
parent | 2c58a5e2753e4f0afc4c937b07b9380398bbe8fd (diff) |
patman: fail early in Setup when provided config file does not exist
Rationale: if the user explicitly provide this argument, they probably
intend for it to be used.
Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | tools/patman/settings.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/patman/settings.py b/tools/patman/settings.py index 8b846799df..c05efd2475 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -340,12 +340,16 @@ def Setup(parser, project_name, config_fname=None): parser: The parser to update. project_name: Name of project that we're working on; we'll look for sections named "project_section" as well. - config_fname: Config filename to read. + config_fname: Config filename to read. An error is raised if it + does not exist. """ # First read the git alias file if available _ReadAliasFile('doc/git-mailrc') config = _ProjectConfigParser(project_name) + if config_fname and not os.path.exists(config_fname): + raise Exception(f'provided {config_fname} does not exist') + if not config_fname: config_fname = '%s/.patman' % os.getenv('HOME') |