Skip to content

Commit

Permalink
add support for direct registered modules, instead of only parent folder
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesdelbeke committed Oct 8, 2021
1 parent 9ad7b9f commit 36d9902
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pyblish/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1321,12 +1321,22 @@ def discover(type=None, regex=None, paths=None):
# Include plug-ins from registered paths
for path in paths or plugin_paths():
path = os.path.normpath(path)
if not os.path.isdir(path):

if not os.path.exists(path):
continue

# check if folder or file
if os.path.isdir(path):
file_paths = [os.path.join(path, fname) for fname in os.listdir(path)]
elif os.path.isfile(path):
# todo check if valid path?
file_paths = [path]

# register plugins from modules in folder
for fname in os.listdir(path):
for abspath in file_paths:

module = _valid_plugin_module(abspath)

if module:
plugins_in_module = plugins_from_module(module)
_register_plugins_helper(plugins_in_module, plugin_names, plugins, module=module)
Expand Down

0 comments on commit 36d9902

Please sign in to comment.