All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonin Godard <antonin.godard@bootlin.com>
To: bitbake-devel@lists.openembedded.org
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	 docs@lists.yoctoproject.org,
	Antonin Godard <antonin.godard@bootlin.com>
Subject: [PATCH 1/2] doc/setversions.py: move arg parsing to main function
Date: Thu, 14 May 2026 12:53:14 +0200	[thread overview]
Message-ID: <20260514-set-versions-fixes-v1-1-70b1fcdda8ee@bootlin.com> (raw)
In-Reply-To: <20260514-set-versions-fixes-v1-0-70b1fcdda8ee@bootlin.com>

Otherwise conflicts with Sphinx's arguments.

Signed-off-by: Antonin Godard <antonin.godard@bootlin.com>
---
 doc/setversions.py | 30 +++++++++++++++++-------------
 1 file changed, 17 insertions(+), 13 deletions(-)

diff --git a/doc/setversions.py b/doc/setversions.py
index dc0bb11e75e..8e934667f93 100755
--- a/doc/setversions.py
+++ b/doc/setversions.py
@@ -24,15 +24,6 @@ import textwrap
 
 from urllib.request import urlopen, URLError
 
-parser = argparse.ArgumentParser(
-    description="Parse https://dashboard.yoctoproject.org/releases.json to get current releases information"
-)
-parser.add_argument("--get-latest-branch",
-                    help="Print current latest branch and exit",
-                    action="store_true",
-                    default=False)
-args = parser.parse_args()
-
 # NOTE: the following variables contain default values in case we are not able to fetch
 # the releases.json file from https://dashboard.yoctoproject.org/releases.json
 DEVBRANCH = "2.18"
@@ -95,16 +86,26 @@ if RELEASES_FROM_JSON:
     # current releases is also an LTS
     ACTIVERELEASES = list(dict.fromkeys([current_branch] + LTSSERIES))
 
-if args.get_latest_branch:
-    print(ACTIVERELEASES[0])
-    sys.exit(0)
-
 print(f"ACTIVERELEASES calculated to be {ACTIVERELEASES}", file=sys.stderr)
 print(f"DEVBRANCH calculated to be {DEVBRANCH}", file=sys.stderr)
 print(f"LTSSERIES calculated to be {LTSSERIES}", file=sys.stderr)
 
 BB_RELEASE_TAG_RE = re.compile(r"^[0-9]+\.[0-9]+\.[0-9]+$")
 
+def main():
+    parser = argparse.ArgumentParser(
+        description="Parse https://dashboard.yoctoproject.org/releases.json to get current releases information"
+    )
+    parser.add_argument("--get-latest-branch",
+                        help="Print current latest branch and exit",
+                        action="store_true",
+                        default=False)
+    args = parser.parse_args()
+
+    if args.get_latest_branch:
+        print(ACTIVERELEASES[0])
+        sys.exit(0)
+
 def get_current_version():
     # Test tags exist and inform the user to fetch if not
     try:
@@ -368,3 +369,6 @@ def write_releases_rst(releases_rst_out: str):
             - :yocto_docs:`1.6.2 BitBake User Manual </1.6.2/bitbake-user-manual/bitbake-user-manual.html>`
             - :yocto_docs:`1.6.3 BitBake User Manual </1.6.3/bitbake-user-manual/bitbake-user-manual.html>`
             """))
+
+if __name__ == "__main__":
+    main()

-- 
2.54.0



  reply	other threads:[~2026-05-14 10:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-14 10:53 [PATCH 0/2] doc: setversions.py fixes Antonin Godard
2026-05-14 10:53 ` Antonin Godard [this message]
2026-05-14 10:53 ` [PATCH 2/2] doc/setversions.py: use older lts series to check tag existence Antonin Godard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260514-set-versions-fixes-v1-1-70b1fcdda8ee@bootlin.com \
    --to=antonin.godard@bootlin.com \
    --cc=bitbake-devel@lists.openembedded.org \
    --cc=docs@lists.yoctoproject.org \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.