Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'doc/python_api/sphinx_doc_update.py')
-rwxr-xr-xdoc/python_api/sphinx_doc_update.py38
1 files changed, 30 insertions, 8 deletions
diff --git a/doc/python_api/sphinx_doc_update.py b/doc/python_api/sphinx_doc_update.py
index 995991c4afd..78bfd3c85b8 100755
--- a/doc/python_api/sphinx_doc_update.py
+++ b/doc/python_api/sphinx_doc_update.py
@@ -94,10 +94,10 @@ def main():
rsync_base = "rsync://%s@%s:%s" % (args.user, args.rsync_server, args.rsync_root)
- blenver = blenver_zip = ""
+ blenver = api_blenver = api_blenver_zip = ""
api_name = ""
branch = ""
- is_release = False
+ is_release = is_beta = False
# I) Update local mirror using rsync.
rsync_mirror_cmd = ("rsync", "--delete-after", "-avzz", rsync_base, args.mirror_dir)
@@ -118,11 +118,14 @@ def main():
"import sys, bpy\n"
"with open(sys.argv[-1], 'w') as f:\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"
" f.write('%d\\n' % is_release)\n"
+ " f.write('%d\\n' % is_beta)\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"
" if is_release else '%d_%d_%d' % bpy.app.version)\n"
)
@@ -130,8 +133,9 @@ def main():
"--python-expr", getver_script, "--", getver_file)
subprocess.run(get_ver_cmd)
with open(getver_file) as f:
- is_release, branch, blenver, blenver_zip = f.read().split("\n")
+ is_release, is_beta, branch, blenver, api_blenver, api_blenver_zip = f.read().split("\n")
is_release = bool(int(is_release))
+ is_beta = bool(int(is_beta))
os.remove(getver_file)
# IV) Build doc.
@@ -143,14 +147,17 @@ def main():
os.chdir(curr_dir)
# V) Cleanup existing matching dir in server mirror (if any), and copy new doc.
- api_name = blenver
+ api_name = api_blenver
api_dir = os.path.join(args.mirror_dir, api_name)
if os.path.exists(api_dir):
- shutil.rmtree(api_dir)
+ if os.path.islink(api_dir):
+ os.remove(api_dir)
+ else:
+ shutil.rmtree(api_dir)
os.rename(os.path.join(tmp_dir, "sphinx-out"), api_dir)
# VI) Create zip archive.
- zip_name = "blender_python_reference_%s" % blenver_zip # We can't use 'release' postfix here...
+ zip_name = "blender_python_reference_%s" % api_blenver_zip # We can't use 'release' postfix here...
zip_path = os.path.join(args.mirror_dir, zip_name)
with zipfile.ZipFile(zip_path, 'w') as zf:
for dirname, _, filenames in os.walk(api_dir):
@@ -163,12 +170,27 @@ def main():
# VII) Create symlinks and html redirects.
if is_release:
symlink = os.path.join(args.mirror_dir, "current")
- os.remove(symlink)
+ if os.path.exists(symlink):
+ if os.path.islink(symlink):
+ os.remove(symlink)
+ else:
+ shutil.rmtree(symlink)
os.symlink("./%s" % api_name, symlink)
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\""
"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":
+ # Also create a symlink from version number to actual master api doc.
+ symlink = os.path.join(args.mirror_dir, blenver)
+ if os.path.exists(symlink):
+ if os.path.islink(symlink):
+ os.remove(symlink)
+ else:
+ shutil.rmtree(symlink)
+ os.symlink("./%s" % api_name, symlink)
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\""
"content=\"0;url=../%s/\"></head><body>Redirecting...</body></html>" % api_name)