Extensions: expose extension tagline to bl_info

An extension's optional "tagline" field is equivalent to a legacy
add-on's "description". This allows exposing the tagline as a
description in `bl_info`.

The main goal of this change is to expose extension taglines to the
translations, since the legacy description was already extracted.

Pull Request: https://projects.blender.org/blender/blender/pulls/122327
This commit is contained in:
Damien Picard 2024-05-27 18:41:04 +02:00 committed by Gitea
parent 8b8d58a7e5
commit f5c4372531

@ -679,7 +679,7 @@ def _bl_info_from_extension(mod_name, mod_path):
# This isn't a full validation which happens on package install/update.
if (value := data.get("name", None)) is None:
print("Error: missing \"name\" from in", filepath_toml)
print("Error: missing \"name\" in", filepath_toml)
return None, filepath_toml
if type(value) is not str:
print("Error: \"name\" is not a string in", filepath_toml)
@ -687,7 +687,7 @@ def _bl_info_from_extension(mod_name, mod_path):
bl_info["name"] = value
if (value := data.get("version", None)) is None:
print("Error: missing \"version\" from in", filepath_toml)
print("Error: missing \"version\" in", filepath_toml)
return None, filepath_toml
if type(value) is not str:
print("Error: \"version\" is not a string in", filepath_toml)
@ -695,7 +695,7 @@ def _bl_info_from_extension(mod_name, mod_path):
bl_info["version"] = value
if (value := data.get("blender_version_min", None)) is None:
print("Error: missing \"blender_version_min\" from in", filepath_toml)
print("Error: missing \"blender_version_min\" in", filepath_toml)
return None, filepath_toml
if type(value) is not str:
print("Error: \"blender_version_min\" is not a string in", filepath_toml)
@ -707,8 +707,16 @@ def _bl_info_from_extension(mod_name, mod_path):
return None, filepath_toml
bl_info["blender"] = value
# Only print warnings since description is not a mandatory field.
if (value := data.get("tagline", None)) is None:
print("Warning: missing \"tagline\" in", filepath_toml)
elif type(value) is not str:
print("Warning: \"tagline\" is not a string", filepath_toml)
else:
bl_info["description"] = value
if (value := data.get("maintainer", None)) is None:
print("Error: missing \"author\" from in", filepath_toml)
print("Error: missing \"author\" in", filepath_toml)
return None, filepath_toml
if type(value) is not str:
print("Error: \"maintainer\" is not a string", filepath_toml)