Merge branch 'blender-v4.2-release'

This commit is contained in:
Campbell Barton 2024-06-28 23:10:14 +10:00
commit 7f2d0f7b14
2 changed files with 9 additions and 7 deletions

@ -1942,7 +1942,7 @@ class EXTENSIONS_OT_package_install_files(Operator, _ExtCmdMixIn):
def exec_command_iter(self, is_modal): def exec_command_iter(self, is_modal):
from . import bl_extension_utils from . import bl_extension_utils
from .bl_extension_utils import ( from .bl_extension_utils import (
pkg_manifest_dict_from_file_or_error, pkg_manifest_dict_from_archive_or_error,
pkg_is_legacy_addon, pkg_is_legacy_addon,
) )
@ -1999,7 +1999,7 @@ class EXTENSIONS_OT_package_install_files(Operator, _ExtCmdMixIn):
continue continue
pkg_files.append(source_filepath) pkg_files.append(source_filepath)
result = pkg_manifest_dict_from_file_or_error(source_filepath) result = pkg_manifest_dict_from_archive_or_error(source_filepath)
if isinstance(result, str): if isinstance(result, str):
continue continue
pkg_id = result["id"] pkg_id = result["id"]
@ -2205,13 +2205,13 @@ class EXTENSIONS_OT_package_install_files(Operator, _ExtCmdMixIn):
self._drop_variables = True self._drop_variables = True
self._legacy_drop = None self._legacy_drop = None
from .bl_extension_utils import pkg_manifest_dict_from_file_or_error from .bl_extension_utils import pkg_manifest_dict_from_archive_or_error
if not self._repos_valid_for_install(context): if not self._repos_valid_for_install(context):
self.report({'ERROR'}, "No user repositories") self.report({'ERROR'}, "No user repositories")
return {'CANCELLED'} return {'CANCELLED'}
if isinstance(result := pkg_manifest_dict_from_file_or_error(filepath), str): if isinstance(result := pkg_manifest_dict_from_archive_or_error(filepath), str):
self.report({'ERROR'}, "Error in manifest {:s}".format(result)) self.report({'ERROR'}, "Error in manifest {:s}".format(result))
return {'CANCELLED'} return {'CANCELLED'}

@ -39,7 +39,7 @@ __all__ = (
"json_to_filepath", "json_to_filepath",
"pkg_manifest_dict_is_valid_or_error", "pkg_manifest_dict_is_valid_or_error",
"pkg_manifest_dict_from_file_or_error", "pkg_manifest_dict_from_archive_or_error",
"pkg_manifest_archive_url_abs_from_remote_url", "pkg_manifest_archive_url_abs_from_remote_url",
"CommandBatch", "CommandBatch",
@ -201,11 +201,13 @@ def rmtree_with_fallback_or_error(
remove_link: bool = True, remove_link: bool = True,
) -> Optional[str]: ) -> Optional[str]:
from .cli.blender_ext import rmtree_with_fallback_or_error as fn from .cli.blender_ext import rmtree_with_fallback_or_error as fn
return fn( result = fn(
path, path,
remove_file=remove_file, remove_file=remove_file,
remove_link=remove_link, remove_link=remove_link,
) )
assert result is None or isinstance(result, str)
return result
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
@ -700,7 +702,7 @@ def pkg_manifest_dict_is_valid_or_error(
return None return None
def pkg_manifest_dict_from_file_or_error( def pkg_manifest_dict_from_archive_or_error(
filepath: str, filepath: str,
) -> Union[Dict[str, Any], str]: ) -> Union[Dict[str, Any], str]:
from .cli.blender_ext import pkg_manifest_from_archive_and_validate from .cli.blender_ext import pkg_manifest_from_archive_and_validate