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:
authorAaron Carlisle <carlisle.b3d@gmail.com>2020-03-05 07:24:13 +0300
committerAaron Carlisle <carlisle.b3d@gmail.com>2020-03-05 07:24:13 +0300
commita0ea0153c262d86dc1ca532315d17974e27cc964 (patch)
tree7bb828850f9b0a8c3284e527dcd41c2a71d9d053 /release
parentae223ff52bed52811873c110ecf1045d2da35b9b (diff)
Addons: Allow a user manual url prefix in doc_url
This was raised in T74017, the issue being that we point to `/dev` version of the manual for the addons when we want to point to a specific version instead. Instead of manually updating the URL every release we can do this. The `bl_info` for addons will need to be updated in the format of `'doc_url': {BLENDER_MANUAL_URL}/addons/import_export/scene_gltf2.html",` Differential Revision: https://developer.blender.org/D6995
Diffstat (limited to 'release')
-rw-r--r--release/scripts/modules/addon_utils.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/release/scripts/modules/addon_utils.py b/release/scripts/modules/addon_utils.py
index 43d62913ff7..a65ff15393a 100644
--- a/release/scripts/modules/addon_utils.py
+++ b/release/scripts/modules/addon_utils.py
@@ -496,6 +496,15 @@ def disable_all():
disable(mod_name)
+def _blender_manual_url_prefix():
+ if _bpy.app.version_cycle in {"rc", "release"}:
+ manual_version = "%d.%d" % _bpy.app.version[:2]
+ else:
+ manual_version = "dev"
+
+ return f"https://docs.blender.org/manual/en/{manual_version}"
+
+
def module_bl_info(mod, info_basis=None):
if info_basis is None:
info_basis = {
@@ -543,5 +552,14 @@ def module_bl_info(mod, info_basis=None):
)
)
+ doc_url = addon_info["doc_url"]
+ if doc_url:
+ doc_url_prefix = "{BLENDER_MANUAL_URL}"
+ if doc_url_prefix in doc_url:
+ addon_info["doc_url"] = doc_url.replace(
+ doc_url_prefix,
+ _blender_manual_url_prefix(),
+ )
+
addon_info["_init"] = None
return addon_info