Skip to content
Snippets Groups Projects
Commit 2839bcf9 authored by Campbell Barton's avatar Campbell Barton
Browse files

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

parent e501ab49
No related branches found
No related tags found
No related merge requests found
...@@ -47,17 +47,21 @@ def get_rig_list(path): ...@@ -47,17 +47,21 @@ def get_rig_list(path):
MODULE_DIR = os.path.dirname(__file__) MODULE_DIR = os.path.dirname(__file__)
RIG_DIR_ABS = os.path.join(MODULE_DIR, utils.RIG_DIR) RIG_DIR_ABS = os.path.join(MODULE_DIR, utils.RIG_DIR)
SEARCH_DIR_ABS = os.path.join(RIG_DIR_ABS, path) SEARCH_DIR_ABS = os.path.join(RIG_DIR_ABS, path)
path_strip = path.strip(os.sep)
files = os.listdir(SEARCH_DIR_ABS) files = os.listdir(SEARCH_DIR_ABS)
files.sort() files.sort()
for f in files: 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) f_abs = os.path.join(SEARCH_DIR_ABS, f)
if os.path.isdir(f_abs): if os.path.isdir(f_abs):
# Check directories # Check directories
module_name = os.path.join(path, f).replace(os.sep, ".")
try: 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: except ImportError as e:
print("Rigify: " + str(e)) print("Rigify: " + str(e))
else: else:
...@@ -72,8 +76,9 @@ def get_rig_list(path): ...@@ -72,8 +76,9 @@ def get_rig_list(path):
elif f.endswith(".py"): elif f.endswith(".py"):
# Check straight-up python files # Check straight-up python files
t = f[:-3] t = f[:-3]
module_name = os.path.join(path, t).replace(os.sep, ".")
try: try:
utils.get_rig_type((path + t).replace("/", ".")).Rig utils.get_rig_type(module_name).Rig
except (ImportError, AttributeError): except (ImportError, AttributeError):
pass pass
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment