diff options
author | Andy Grover <agrover@redhat.com> | 2011-08-25 13:39:15 -0700 |
---|---|---|
committer | Andy Grover <agrover@redhat.com> | 2011-12-05 14:07:06 -0800 |
commit | 672a80e253a67439168fef411804d9459ae086e0 (patch) | |
tree | 8bb19f6057ff05a96b8de0fa55316ee8873b18dd /configshell | |
parent | d866b2459dcf480a7202b86085c8d02e8ea5d2d6 (diff) | |
download | configshell-fb-672a80e253a67439168fef411804d9459ae086e0.tar.gz |
Do not require epydoc at runtime
It's a little excessive to require the entire epydoc package so that
configshell can output italic/bold help text. If it's present, use it,
but otherwise just print plaintext.
Signed-off-by: Andy Grover <agrover@redhat.com>
Diffstat (limited to 'configshell')
-rw-r--r-- | configshell/console.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/configshell/console.py b/configshell/console.py index d463879..985d789 100644 --- a/configshell/console.py +++ b/configshell/console.py @@ -25,6 +25,12 @@ from fcntl import ioctl import epydoc.markup.epytext from termios import TIOCGWINSZ, TCSADRAIN, tcsetattr, tcgetattr +# avoid requiring epydoc at runtime +try: + import epydoc.markup.epytext +except ImportError: + pass + class Console(object): ''' Implements various utility methods providing a console UI support toolkit, @@ -154,6 +160,14 @@ class Console(object): text = self.dedent(text) try: dom_tree = epydoc.markup.epytext.parse(text, None) + except NameError: + # epydoc not installed, strip markup + dom_tree = text + dom_tree = dom_tree.replace("B{", "") + dom_tree = dom_tree.replace("I{", "") + dom_tree = dom_tree.replace("C{", "") + dom_tree = dom_tree.replace("}", "") + dom_tree += "\n" except: self.display(text) raise |