From c398e1fca35c5c379acb53b1c47bce8a493affb9 Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:03:37 +0200 Subject: [PATCH] hash dirpath for sys modules --- client/ayon_core/pipeline/publish/lib.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/client/ayon_core/pipeline/publish/lib.py b/client/ayon_core/pipeline/publish/lib.py index ddb1c46def..c0b138c7f2 100644 --- a/client/ayon_core/pipeline/publish/lib.py +++ b/client/ayon_core/pipeline/publish/lib.py @@ -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 @@ -257,15 +258,18 @@ def publish_plugins_discover( filenames.append(os.path.basename(path)) path = os.path.dirname(path) + dirpath_hash = hashlib.md5(path.encode("utf-8")).hexdigest() for filename in filenames: mod_name, mod_ext = os.path.splitext(filename) if mod_ext.lower() != ".py": continue filepath = os.path.join(path, filename) + sys_module_name = f"{dirpath_hash}.{mod_name}" try: module = import_filepath( - filepath, mod_name, sys_module_name=mod_name + filepath, mod_name, sys_module_name=sys_module_name + ) except Exception as err: # noqa: BLE001 # we need broad exception to catch all possible errors.