diff mbox series

[yocto-autobuilder-helper,2/2] scripts/release-parser: use argparse for argument handling

Message ID CADfgfoYKSrRf0KHeds+NQ2rmFUc4PTgW9n8nPiWeRrG4Jzi4iQ@mail.gmail.com
State New
Headers show
Series base branch names on branches instead of tags | expand

Commit Message

Michael Halstead March 27, 2026, 9:02 a.m. UTC
scripts/release-parser: use argparse for argument handling

Replace raw sys.argv access with argparse so that usage and help text
are printed when the script is called without the required arguments.

Signed-off-by: Michael Halstead <mhalstead@linuxfoundation.org>
---
 scripts/release-parser.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/scripts/release-parser.py b/scripts/release-parser.py
index 9e5bc6a..2aedeb2 100755
--- a/scripts/release-parser.py
+++ b/scripts/release-parser.py
@@ -1,5 +1,6 @@ 
 #!/usr/bin/env python3

+import argparse
 import json
 import re
 import semver
@@ -7,10 +8,15 @@  import sys

 from git import Repo

-# this is the repository where we fetch most of our tag data
-GIT_REPO = sys.argv[1]
-# the bitbake repository is used to associate bitbake versions to them
-BITBAKE_REPO = sys.argv[2]
+parser = argparse.ArgumentParser(
+    description="Parse Yocto Project release tags and generate releases.json"
+)
+parser.add_argument("docs_repo", help="Path to the yocto-docs git repository")
+parser.add_argument("bitbake_repo", help="Path to the bitbake git repository")
+args = parser.parse_args()
+
+GIT_REPO = args.docs_repo
+BITBAKE_REPO = args.bitbake_repo

 print(f"Reading tag information in {GIT_REPO}")