[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1164] trunk/py/scripts/addons/rigify/ __init__.py: minor edits from my last patch, possible win32 fix and warn if '.' in dir names.

Campbell Barton ideasman42 at gmail.com
Wed Nov 17 08:35:02 CET 2010


Revision: 1164
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1164
Author:   campbellbarton
Date:     2010-11-17 08:35:01 +0100 (Wed, 17 Nov 2010)

Log Message:
-----------
minor edits from my last patch, possible win32 fix and warn if '.' in dir names.

Modified Paths:
--------------
    trunk/py/scripts/addons/rigify/__init__.py

Modified: trunk/py/scripts/addons/rigify/__init__.py
===================================================================
--- trunk/py/scripts/addons/rigify/__init__.py	2010-11-17 07:03:00 UTC (rev 1163)
+++ trunk/py/scripts/addons/rigify/__init__.py	2010-11-17 07:35:01 UTC (rev 1164)
@@ -47,17 +47,21 @@
     MODULE_DIR = os.path.dirname(__file__)
     RIG_DIR_ABS = os.path.join(MODULE_DIR, utils.RIG_DIR)
     SEARCH_DIR_ABS = os.path.join(RIG_DIR_ABS, path)
-    path_strip = path.strip(os.sep)
     files = os.listdir(SEARCH_DIR_ABS)
     files.sort()
 
     for f in files:
-        if not f.startswith("_") and not f.startswith("."):
+        if f[0] in (".", "_"):
+            pass
+        elif "." in f:
+            print("Warning: %r, filename contains a '.', skipping" % os.path.join(SEARCH_DIR_ABS, f))
+        else:
             f_abs = os.path.join(SEARCH_DIR_ABS, f)
             if os.path.isdir(f_abs):
                 # Check directories
+                module_name = os.path.join(path, f).replace(os.sep, ".")
                 try:
-                    rig = utils.get_rig_type(os.path.join(path_strip, f).replace(os.sep, "."))
+                    rig = utils.get_rig_type(module_name)
                 except ImportError as e:
                     print("Rigify: " + str(e))
                 else:
@@ -72,8 +76,9 @@
             elif f.endswith(".py"):
                 # Check straight-up python files
                 t = f[:-3]
+                module_name = os.path.join(path, t).replace(os.sep, ".")
                 try:
-                    utils.get_rig_type((path + t).replace("/", ".")).Rig
+                    utils.get_rig_type(module_name).Rig
                 except (ImportError, AttributeError):
                     pass
                 else:




More information about the Bf-extensions-cvs mailing list