From 689ee58bf8182a5a5e2479caa9986a5176c3623b Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Mon, 11 Oct 2021 10:30:50 -0400 Subject: [PATCH] contrib: have apiage fail if no source data is available It is kind of pointless to let the tool run if no source data is present, so treat empty/missing source as an error. Signed-off-by: John Mulligan --- contrib/apiage.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/apiage.py b/contrib/apiage.py index 20de47c..c934695 100755 --- a/contrib/apiage.py +++ b/contrib/apiage.py @@ -278,6 +278,12 @@ def main(): api_src = read_json(cli.source) if cli.source else {} api_tracked = read_json(cli.current) if cli.current else {} + if not api_src: + print( + f"error: no source data found (path: {cli.source})", file=sys.stderr + ) + sys.exit(1) + if cli.current_tag: tag_to_versions(cli, cli.current_tag)