1
0
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:
Sergei Trofimov 2017-02-23 13:15:27 +00:00
parent 05215e7e1b
commit fef7c16b42

View File

@ -192,6 +192,9 @@ def walk_modules(path):
root_mod = __try_import(path)
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__):
submod_path = '.'.join([path, name])
if ispkg: