Merge branch 'blender-v4.2-release'

This commit is contained in:
Campbell Barton 2024-07-01 15:16:39 +10:00
commit 7447f6415e
6 changed files with 32 additions and 50 deletions

@ -39,14 +39,12 @@ def _local_module_reload():
import importlib
from . import (
bl_extension_cli,
bl_extension_local,
bl_extension_notify,
bl_extension_ops,
bl_extension_ui,
bl_extension_utils,
)
importlib.reload(bl_extension_cli)
importlib.reload(bl_extension_local)
importlib.reload(bl_extension_notify)
importlib.reload(bl_extension_ops)
importlib.reload(bl_extension_ui)

@ -1,46 +0,0 @@
# SPDX-FileCopyrightText: 2023 Blender Foundation
#
# SPDX-License-Identifier: GPL-2.0-or-later
"""
High level API for managing an extension local site-packages and wheels.
NOTE: this is a standalone module.
"""
__all__ = (
"sync",
)
import os
import sys
from typing import (
List,
)
from .wheel_manager import WheelSource
def sync(
*,
local_dir: str,
wheel_list: List[WheelSource],
) -> None:
from . import wheel_manager
local_dir_site_packages = os.path.join(
local_dir,
"lib",
"python{:d}.{:d}".format(sys.version_info.major, sys.version_info.minor),
"site-packages",
)
wheel_manager.apply_action(
local_dir=local_dir,
local_dir_site_packages=local_dir_site_packages,
wheel_list=wheel_list,
)
if os.path.exists(local_dir_site_packages):
if local_dir_site_packages not in sys.path:
sys.path.append(local_dir_site_packages)

@ -824,7 +824,7 @@ def _extensions_repo_sync_wheels(repo_cache_store):
This function collects all wheels from all packages and ensures the packages are either extracted or removed
when they are no longer used.
"""
from .bl_extension_local import sync
import addon_utils
repos_all = extension_repos_read()
@ -864,7 +864,8 @@ def _extensions_repo_sync_wheels(repo_cache_store):
extensions = bpy.utils.user_resource('EXTENSIONS')
local_dir = os.path.join(extensions, ".local")
sync(
# WARNING: bad level call, avoid making this a public function just now.
addon_utils._extension_sync_wheels(
local_dir=local_dir,
wheel_list=wheel_list,
)

@ -765,6 +765,32 @@ def _fake_module_from_extension(mod_name, mod_path):
return mod
def _extension_sync_wheels(
*,
local_dir, # `str`
wheel_list, # `List[WheelSource]`
): # `-> None`
import os
import sys
from _bpy_internal.extensions.wheel_manager import apply_action
local_dir_site_packages = os.path.join(
local_dir,
"lib",
"python{:d}.{:d}".format(*sys.version_info[0:2]),
"site-packages",
)
apply_action(
local_dir=local_dir,
local_dir_site_packages=local_dir_site_packages,
wheel_list=wheel_list,
)
if os.path.exists(local_dir_site_packages):
if local_dir_site_packages not in sys.path:
sys.path.append(local_dir_site_packages)
# -----------------------------------------------------------------------------
# Extensions

@ -14,6 +14,9 @@ PATHS: Tuple[Tuple[str, Tuple[Any, ...], Dict[str, str]], ...] = (
("build_files/utils/", (), {'MYPYPATH': "modules"}),
("doc/manpage/blender.1.py", (), {}),
("release/datafiles/", (), {}),
("scripts/modules/_bpy_internal/extensions/junction_module.py", (), {}),
("scripts/modules/_bpy_internal/extensions/wheel_manager.py", (), {}),
("scripts/modules/_bpy_internal/freedesktop.py", (), {}),
("tools/check_blender_release/", (), {}),
("tools/check_docs/", (), {}),
("tools/check_source/", (), {'MYPYPATH': "modules"}),