51 lines
1.5 KiB
Diff
51 lines
1.5 KiB
Diff
|
From 06b7577eec64de5cca72496127fc0cdde4195c7a Mon Sep 17 00:00:00 2001
|
||
|
From: Andy Grover <agrover@redhat.com>
|
||
|
Date: Thu, 25 Aug 2011 13:39:15 -0700
|
||
|
Subject: [PATCH] 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>
|
||
|
---
|
||
|
configshell/console.py | 15 ++++++++++++++-
|
||
|
1 files changed, 14 insertions(+), 1 deletions(-)
|
||
|
|
||
|
diff --git a/configshell/console.py b/configshell/console.py
|
||
|
index 52558dd..a6871e1 100644
|
||
|
--- a/configshell/console.py
|
||
|
+++ b/configshell/console.py
|
||
|
@@ -23,7 +23,12 @@ import prefs
|
||
|
import struct
|
||
|
import termios
|
||
|
import textwrap
|
||
|
-import epydoc.markup.epytext
|
||
|
+
|
||
|
+# avoid requiring epydoc at runtime
|
||
|
+try:
|
||
|
+ import epydoc.markup.epytext
|
||
|
+except ImportError:
|
||
|
+ pass
|
||
|
|
||
|
class Console(object):
|
||
|
'''
|
||
|
@@ -150,6 +155,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
|
||
|
--
|
||
|
1.7.1
|
||
|
|