Py API doc generator: tweak to handle new release process.

We need to handle beta stage in a specific way, since it's no longer
master, but not yet 'real' rc/release stage...

For now, only point to version dir of the API doc, but no need to create
any symlink (that way, 'current' remain pointing to 2.80 release, while
'2.81' is no longer a symlink to 'master', but its own actual doc).
This commit is contained in:
Bastien Montagne 2019-10-14 17:36:27 +02:00
parent 6b6b27fd13
commit 15539f7b6d

@ -118,11 +118,13 @@ def main():
"import sys, bpy\n" "import sys, bpy\n"
"with open(sys.argv[-1], 'w') as f:\n" "with open(sys.argv[-1], 'w') as f:\n"
" is_release = bpy.app.version_cycle in {'rc', 'release'}\n" " is_release = bpy.app.version_cycle in {'rc', 'release'}\n"
" is_beta = bpy.app.version_cycle in {'beta'}\n"
" branch = bpy.app.build_branch.split()[0].decode()\n" " branch = bpy.app.build_branch.split()[0].decode()\n"
" f.write('%d\\n' % is_release)\n" " f.write('%d\\n' % is_release)\n"
" f.write('%d\\n' % is_beta)\n"
" f.write('%s\\n' % branch)\n" " f.write('%s\\n' % branch)\n"
" f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" " f.write('%d.%d%s\\n' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if is_release else '%s\\n' % branch)\n" " if (is_release or is_beta) else '%s\\n' % branch)\n"
" f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n" " f.write('%d_%d%s_release' % (bpy.app.version[0], bpy.app.version[1], bpy.app.version_char)\n"
" if is_release else '%d_%d_%d' % bpy.app.version)\n" " if is_release else '%d_%d_%d' % bpy.app.version)\n"
) )
@ -130,8 +132,9 @@ def main():
"--python-expr", getver_script, "--", getver_file) "--python-expr", getver_script, "--", getver_file)
subprocess.run(get_ver_cmd) subprocess.run(get_ver_cmd)
with open(getver_file) as f: with open(getver_file) as f:
is_release, branch, blenver, blenver_zip = f.read().split("\n") is_release, is_beta, branch, blenver, blenver_zip = f.read().split("\n")
is_release = bool(int(is_release)) is_release = bool(int(is_release))
is_beta = bool(int(is_beta))
os.remove(getver_file) os.remove(getver_file)
# IV) Build doc. # IV) Build doc.
@ -146,6 +149,9 @@ def main():
api_name = blenver api_name = blenver
api_dir = os.path.join(args.mirror_dir, api_name) api_dir = os.path.join(args.mirror_dir, api_name)
if os.path.exists(api_dir): if os.path.exists(api_dir):
if os.path.islink(api_dir):
os.remove(api_dir)
else:
shutil.rmtree(api_dir) shutil.rmtree(api_dir)
os.rename(os.path.join(tmp_dir, "sphinx-out"), api_dir) os.rename(os.path.join(tmp_dir, "sphinx-out"), api_dir)
@ -168,6 +174,9 @@ def main():
with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f: with open(os.path.join(args.mirror_dir, "250PythonDoc/index.html"), 'w') as f:
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\"" f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name) "content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)
elif is_beta:
# We do not have any particular symlink for that stage.
pass
elif branch == "master": elif branch == "master":
with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f: with open(os.path.join(args.mirror_dir, "blender_python_api/index.html"), 'w') as f:
f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\"" f.write("<html><head><title>Redirecting...</title><meta http-equiv=\"REFRESH\""