mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
utils/misc: allow modules in walk_modules input
Previsously, the import path passed to walk_modules must have been pointing to a package. This update allows the path to point to a single module.
This commit is contained in:
parent
05215e7e1b
commit
fef7c16b42
@ -192,6 +192,9 @@ def walk_modules(path):
|
|||||||
|
|
||||||
root_mod = __try_import(path)
|
root_mod = __try_import(path)
|
||||||
mods = [root_mod]
|
mods = [root_mod]
|
||||||
|
if not hasattr(root_mod, '__path__'):
|
||||||
|
# root is a module not a package -- nothing to walk
|
||||||
|
return mods
|
||||||
for _, name, ispkg in pkgutil.iter_modules(root_mod.__path__):
|
for _, name, ispkg in pkgutil.iter_modules(root_mod.__path__):
|
||||||
submod_path = '.'.join([path, name])
|
submod_path = '.'.join([path, name])
|
||||||
if ispkg:
|
if ispkg:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user