doc: setversions.py fixes
cover doc: setversions.py fixes
Signed-off-by Antonin Godard <[email protected]>
---
Antonin Godard (2):
doc/setversions.py: move arg parsing to main function doc/setversions.py: use older lts series to check tag existence
doc/setversions.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-)
---
base-commit: 2b47c2fc40b753e260b63ec419edfd1f85adff90
change-id: 20260514-set-versions-fixes-886e8d5a8fce
PATCH 1/2 doc/setversions.py: move arg parsing to main function
Otherwise conflicts with Sphinx's arguments.
Signed-off-by Antonin Godard <[email protected]>
--- doc/setversions.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
doc/setversions.py +17 -13
@@ -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()
Signature · 1 line
2.54.0
PATCH 2/2 doc/setversions.py: use older lts series to check tag existence
In reply to Antonin GodardUsing the most recent LTS series to check if a tag exist may fail if the LTS was recently created. Use the older one instead.
Signed-off-by Antonin Godard <[email protected]>
--- doc/setversions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
doc/setversions.py +1 -1
@@ -109,7 +109,7 @@ def main(): def get_current_version(): # Test tags exist and inform the user to fetch if not try: - subprocess.run(["git", "show", f"{LTSSERIES[0]}.0"], + subprocess.run(["git", "show", f"{LTSSERIES[-1]}.0"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True) except subprocess.CalledProcessError: sys.exit("Please run 'git fetch --tags' before building the documentation")
Signature · 1 line
2.54.0