[PATCH 1/8] Do not require epydoc at runtime

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux