Merge branch 'develop' into bugfix/detect_rounding_available_range

This commit is contained in:
robin@ynput.io 2025-07-29 09:26:14 -04:00
commit 522b657769

View file

@ -5,6 +5,7 @@ import sys
import inspect
import copy
import warnings
import hashlib
import xml.etree.ElementTree
from typing import TYPE_CHECKING, Optional, Union, List
@ -243,32 +244,38 @@ def publish_plugins_discover(
for path in paths:
path = os.path.normpath(path)
if not os.path.isdir(path):
continue
filenames = []
if os.path.isdir(path):
filenames.extend(
name
for name in os.listdir(path)
if (
os.path.isfile(os.path.join(path, name))
and not name.startswith("_")
)
)
else:
filenames.append(os.path.basename(path))
path = os.path.dirname(path)
for fname in os.listdir(path):
if fname.startswith("_"):
continue
abspath = os.path.join(path, fname)
if not os.path.isfile(abspath):
continue
mod_name, mod_ext = os.path.splitext(fname)
if mod_ext != ".py":
dirpath_hash = hashlib.md5(path.encode("utf-8")).hexdigest()
for filename in filenames:
basename, ext = os.path.splitext(filename)
if ext.lower() != ".py":
continue
filepath = os.path.join(path, filename)
module_name = f"{dirpath_hash}.{basename}"
try:
module = import_filepath(
abspath, mod_name, sys_module_name=mod_name)
filepath, module_name, sys_module_name=module_name
)
except Exception as err: # noqa: BLE001
# we need broad exception to catch all possible errors.
result.crashed_file_paths[abspath] = sys.exc_info()
result.crashed_file_paths[filepath] = sys.exc_info()
log.debug('Skipped: "%s" (%s)', mod_name, err)
log.debug('Skipped: "%s" (%s)', filepath, err)
continue
for plugin in pyblish.plugin.plugins_from_module(module):