diff options
Diffstat (limited to 'release/scripts/modules/bpy')
-rw-r--r-- | release/scripts/modules/bpy/path.py | 14 | ||||
-rw-r--r-- | release/scripts/modules/bpy/utils.py | 2 |
2 files changed, 9 insertions, 7 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py index 714a3a07f95..a5b86b917b2 100644 --- a/release/scripts/modules/bpy/path.py +++ b/release/scripts/modules/bpy/path.py @@ -183,7 +183,7 @@ def module_names(path, recursive=False): :type path: string :arg recursive: Also return submodule names for packages. :type recursive: bool - :return: a list of strings. + :return: a list of string pairs (module_name, module_file). :rtype: list """ @@ -193,13 +193,15 @@ def module_names(path, recursive=False): for filename in sorted(_os.listdir(path)): if filename.endswith(".py") and filename != "__init__.py": - modules.append(filename[0:-3]) + fullpath = join(path, filename) + modules.append((filename[0:-3], fullpath)) elif ("." not in filename): directory = join(path, filename) - if isfile(join(directory, "__init__.py")): - modules.append(filename) + fullpath = join(directory, "__init__.py") + if isfile(fullpath): + modules.append((filename, fullpath)) if recursive: - for mod_name in module_names(directory, True): - modules.append("%s.%s" % (filename, mod_name)) + for mod_name, mod_path in module_names(directory, True): + modules.append(("%s.%s" % (filename, mod_name), mod_path)) return modules diff --git a/release/scripts/modules/bpy/utils.py b/release/scripts/modules/bpy/utils.py index 9b0c758404e..f5144d6cdf5 100644 --- a/release/scripts/modules/bpy/utils.py +++ b/release/scripts/modules/bpy/utils.py @@ -70,7 +70,7 @@ def modules_from_path(path, loaded_modules): modules = [] - for mod_name in _bpy.path.module_names(path): + for mod_name, mod_path in _bpy.path.module_names(path): mod = _test_import(mod_name, loaded_modules) if mod: modules.append(mod) |