[Bf-blender-cvs] [9267e6275cc] master: PyAPI: change behavior of bpy.path.module_names

Campbell Barton noreply at git.blender.org
Mon Oct 28 16:16:23 CET 2019


Commit: 9267e6275cc925ec3476b0a810e840cefd658170
Author: Campbell Barton
Date:   Tue Oct 29 02:06:10 2019 +1100
Branches: master
https://developer.blender.org/rB9267e6275cc925ec3476b0a810e840cefd658170

PyAPI: change behavior of bpy.path.module_names

Instead of checking for names that contain ".", only skip files
that start with a "." (since they're used for ".git" & ".arcconfig").

While other path names may fail to import, it's not the purpose of this
function to validate the path, have the caller must raise an error
instead of silently skipping them.

See D6140.

===================================================================

M	release/scripts/modules/bpy/path.py

===================================================================

diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py
index 845475b9180..3860445233d 100644
--- a/release/scripts/modules/bpy/path.py
+++ b/release/scripts/modules/bpy/path.py
@@ -352,7 +352,8 @@ def module_names(path, recursive=False):
         elif filename.endswith(".py") and filename != "__init__.py":
             fullpath = join(path, filename)
             modules.append((filename[0:-3], fullpath))
-        elif "." not in filename:
+        elif not filename.startswith("."):
+            # Skip hidden files since they are used by for version control.
             directory = join(path, filename)
             fullpath = join(directory, "__init__.py")
             if isfile(fullpath):



More information about the Bf-blender-cvs mailing list