summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2011-04-26 16:28:22 -0300
committerLauro Neto <lauro.neto@openbossa.org>2011-04-28 14:56:55 -0300
commitb32b614d1b5d61535aa60c6e192014acaf2be96d (patch)
tree711c147497f687ea435ace0407f99ab3a1b9ccd7 /doc
parenta68d4b04f321e94d279abf96b80d78d7ced9024c (diff)
downloadpyside-b32b614d1b5d61535aa60c6e192014acaf2be96d.tar.gz
pyside-b32b614d1b5d61535aa60c6e192014acaf2be96d.tar.xz
pyside-b32b614d1b5d61535aa60c6e192014acaf2be96d.zip
Update inheritance diagram sphinx extension.
Better handling missing classes. Reviewer: Renato Araujo <renato.filho@openbossa.org> Reviewer: Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'doc')
-rw-r--r--doc/inheritance_diagram.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/doc/inheritance_diagram.py b/doc/inheritance_diagram.py
index 7b13094..616b470 100644
--- a/doc/inheritance_diagram.py
+++ b/doc/inheritance_diagram.py
@@ -100,15 +100,22 @@ class InheritanceGraph(object):
__import__(fullname)
todoc = sys.modules[fullname]
except ImportError:
+ # else it is a class, then import the module
+ if not path:
+ if currmodule:
+ # try the current module
+ path = currmodule
+ else:
+ raise InheritanceException(
+ 'Could not import class %r specified for '
+ 'inheritance diagram' % base)
try:
- __import__(currmodule)
- todoc = sys.modules[currmodule]
- for attr in name.split('.'):
- todoc = getattr(todoc, attr)
+ __import__(path)
+ todoc = getattr(sys.modules[path], base)
except (ImportError, AttributeError):
raise InheritanceException(
'Could not import class or module %r specified for '
- 'inheritance diagram' % (currmodule + '.' + name))
+ 'inheritance diagram' % (path + '.' + base))
# If a class, just return it
if inspect.isclass(todoc):