From 8827704443363068db7181bc0698cbda5d35b01d Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Fri, 18 Mar 2022 16:21:19 +0000 Subject: set_versions/switchers.js: Allow switchers.js version information to be autogenerated A horrible blunt hammer approach to updating the version information in switchers.js based on the available tag information. To merge and work correctly, this will need a change to the autobuilder-helper docs generation code to pull the swicthers.js and script from master, then to run the script. That should hopefully remove the need for other patching even on old docs branches though. (From yocto-docs rev: dc858c8b2ffdb792fe8cef05fab3d752aa858f78) Signed-off-by: Richard Purdie --- documentation/set_versions.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'documentation/set_versions.py') diff --git a/documentation/set_versions.py b/documentation/set_versions.py index 96e0d34697..94e2704a50 100755 --- a/documentation/set_versions.py +++ b/documentation/set_versions.py @@ -149,3 +149,22 @@ with open("poky.yaml.in", "r") as r, open("poky.yaml", "w") as w: print("poky.yaml generated from poky.yaml.in") +with open("sphinx-static/switchers.js.in", "r") as r, open("sphinx-static/switchers.js", "w") as w: + lines = r.readlines() + for line in lines: + if "VERSIONS_PLACEHOLDER" in line: + w.write(" 'dev': 'dev (%s)',\n" % release_series[devbranch]) + for branch in activereleases: + if branch == devbranch: + continue + versions = subprocess.run('git tag --list yocto-%s*' % (release_series[branch]), shell=True, capture_output=True, text=True).stdout.split() + versions = sorted([v.replace("yocto-" + release_series[branch] + ".", "").replace("yocto-" + release_series[branch], "0") for v in versions], key=int) + version = release_series[branch] + if versions[-1] != "0": + version = version + "." + versions[-1] + w.write(" '%s': '%s',\n" % (version, version)) + else: + w.write(line) + +print("switchers.js generated from switchers.js.in") + -- cgit v1.2.3-54-g00ecf