From 3d0238a6caba987a7d959de98354713518899ac3 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Fri, 1 Apr 2022 19:41:29 +0200 Subject: [PATCH 1/4] removed unused imports --- .../ftrack/event_handlers_user/action_create_folders.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/openpype/modules/ftrack/event_handlers_user/action_create_folders.py b/openpype/modules/ftrack/event_handlers_user/action_create_folders.py index d15a865124..0ed12bd03e 100644 --- a/openpype/modules/ftrack/event_handlers_user/action_create_folders.py +++ b/openpype/modules/ftrack/event_handlers_user/action_create_folders.py @@ -1,11 +1,6 @@ import os from openpype_modules.ftrack.lib import BaseAction, statics_icon -from avalon import lib as avalonlib -from openpype.api import ( - Anatomy, - get_project_settings -) -from openpype.lib import ApplicationManager +from openpype.api import Anatomy class CreateFolders(BaseAction): From 840daefb9fe188b91deefb40b3669caf5f4fb6bf Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 6 Apr 2022 13:31:20 +0200 Subject: [PATCH 2/4] added example_addons into ignored filenames --- openpype/modules/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/openpype/modules/base.py b/openpype/modules/base.py index 5cdeb86087..2d5545d135 100644 --- a/openpype/modules/base.py +++ b/openpype/modules/base.py @@ -37,6 +37,7 @@ IGNORED_DEFAULT_FILENAMES = ( "__init__.py", "base.py", "interfaces.py", + "example_addons", ) From 02afd4b915c078b0bf67b02a61a0244e819facb4 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 6 Apr 2022 13:31:46 +0200 Subject: [PATCH 3/4] subfolder of module must have init file --- openpype/modules/base.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/openpype/modules/base.py b/openpype/modules/base.py index 2d5545d135..94aa8fca1b 100644 --- a/openpype/modules/base.py +++ b/openpype/modules/base.py @@ -304,7 +304,13 @@ def _load_modules(): fullpath = os.path.join(current_dir, filename) basename, ext = os.path.splitext(filename) - if not os.path.isdir(fullpath) and ext not in (".py", ): + if os.path.isdir(fullpath): + # Check existence of init fil + init_path = os.path.join(fullpath, "__init__.py") + if not os.path.exists(init_path): + continue + + elif ext not in (".py", ): continue try: @@ -342,7 +348,13 @@ def _load_modules(): fullpath = os.path.join(dirpath, filename) basename, ext = os.path.splitext(filename) - if not os.path.isdir(fullpath) and ext not in (".py", ): + if os.path.isdir(fullpath): + # Check existence of init fil + init_path = os.path.join(fullpath, "__init__.py") + if not os.path.exists(init_path): + continue + + elif ext not in (".py", ): continue # TODO add more logic how to define if folder is module or not From 062b584ecbc47c46f5f3933d346ffdf67cb6d48b Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Wed, 6 Apr 2022 13:41:31 +0200 Subject: [PATCH 4/4] added default_modules subfolder into ignored filenames --- openpype/modules/base.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/openpype/modules/base.py b/openpype/modules/base.py index 94aa8fca1b..23c908299f 100644 --- a/openpype/modules/base.py +++ b/openpype/modules/base.py @@ -38,6 +38,7 @@ IGNORED_DEFAULT_FILENAMES = ( "base.py", "interfaces.py", "example_addons", + "default_modules", ) @@ -308,6 +309,9 @@ def _load_modules(): # Check existence of init fil init_path = os.path.join(fullpath, "__init__.py") if not os.path.exists(init_path): + log.debug(( + "Module directory does not contan __init__.py file {}" + ).format(fullpath)) continue elif ext not in (".py", ): @@ -352,6 +356,9 @@ def _load_modules(): # Check existence of init fil init_path = os.path.join(fullpath, "__init__.py") if not os.path.exists(init_path): + log.debug(( + "Module directory does not contan __init__.py file {}" + ).format(fullpath)) continue elif ext not in (".py", ):