diff options
author | Nathan Vegdahl <cessen@cessen.com> | 2013-02-23 23:55:56 +0400 |
---|---|---|
committer | Nathan Vegdahl <cessen@cessen.com> | 2013-02-23 23:55:56 +0400 |
commit | 5b6e54f7d1ff8f2ea13511e023387457b66aa263 (patch) | |
tree | 6de89241bd2d5b9af94aa1619fd45819cc269856 /rigify/rig_lists.py | |
parent | 9b5dc064cf580f229b096983152b2cc8cc83ede5 (diff) |
Rigify: bug fix: certain kinds of import errors were being suppressed in
rig types.
Diffstat (limited to 'rigify/rig_lists.py')
-rw-r--r-- | rigify/rig_lists.py | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/rigify/rig_lists.py b/rigify/rig_lists.py index c8c56310..66f0a33e 100644 --- a/rigify/rig_lists.py +++ b/rigify/rig_lists.py @@ -17,6 +17,8 @@ #======================= END GPL LICENSE BLOCK ======================== import os +import traceback +import logging from . import utils @@ -33,37 +35,32 @@ def get_rig_list(path): for f in files: is_dir = os.path.isdir(os.path.join(SEARCH_DIR_ABS, f)) # Whether the file is a directory - if f[0] in {".", "_"}: - pass - elif f.count(".") >= 2 or (is_dir and "." in f): + + # Stop cases + if f[0] in [".", "_"]: + continue + if f.count(".") >= 2 or (is_dir and "." in f): print("Warning: %r, filename contains a '.', skipping" % os.path.join(SEARCH_DIR_ABS, f)) - else: - if is_dir: - # Check directories - module_name = os.path.join(path, f).replace(os.sep, ".") - try: - rig = utils.get_rig_type(module_name) - except ImportError as e: - print("Rigify: " + str(e)) - else: - # Check if it's a rig itself - if not hasattr(rig, "Rig"): - # Check for sub-rigs - ls = get_rig_list(os.path.join(path, f, "")) # "" adds a final slash - rigs.extend(["%s.%s" % (f, l) for l in ls]) - else: - rigs += [f] + continue - 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(module_name).Rig - except (ImportError, AttributeError): - pass - else: - rigs += [t] + if is_dir: + # Check directories + module_name = os.path.join(path, f).replace(os.sep, ".") + rig = utils.get_rig_type(module_name) + # Check if it's a rig itself + if hasattr(rig, "Rig"): + rigs += [f] + else: + # Check for sub-rigs + ls = get_rig_list(os.path.join(path, f, "")) # "" adds a final slash + rigs.extend(["%s.%s" % (f, l) for l in ls]) + elif f.endswith(".py"): + # Check straight-up python files + t = f[:-3] + module_name = os.path.join(path, t).replace(os.sep, ".") + rig = utils.get_rig_type(module_name) + if hasattr(rig, "Rig"): + rigs += [t] rigs.sort() return rigs |