From 3786392274908dd70f39baf4d04879fc5e0fce49 Mon Sep 17 00:00:00 2001 From: Bob Farrell Date: Tue, 19 Aug 2008 09:42:21 +0100 Subject: [PATCH] pyparsing and pygments are now actual dependencies. For political reasons I have made pyparsing and pygments actual dependencies. It seems that unless bpython actually won't work without these two packages then certain Norwegian people will not package bpython for Ubuntu with them as actual dependencies, meaning people would have to apt-get install them separately (by which point they would probably have decided bpython sucks and won't ever use it again). Jorgen is right, though - they are a huge part of what makes bpython what it is, so they should be dependencies. --- bpython.py | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/bpython.py b/bpython.py index dd8f265..0a6526d 100644 --- a/bpython.py +++ b/bpython.py @@ -43,7 +43,7 @@ import termios import fcntl import string import shlex -from bpython.formatter import BPythonFormatter +import pydoc class Dummy( object ): pass @@ -51,31 +51,15 @@ OPTS = Dummy() OPTS.auto_display_list = True -try: - from pygments import highlight - from pygments.lexers import PythonLexer -except ImportError: - OPTS.syntax = False -else: - OPTS.syntax = True +from pygments import highlight +from pygments.lexers import PythonLexer +from bpython.formatter import BPythonFormatter +OPTS.syntax = True -try: - from pyparsing import Forward, Suppress, QuotedString, dblQuotedString, \ - Group, OneOrMore, ZeroOrMore, Literal, Optional, Word, \ - alphas, alphanums, printables, ParseException -except ImportError: - OPTS.arg_spec = False - print ("pyparsing could not be imported properly, " - "parameter list spec will not work." ) -# XXX: This is for later, as the loadrc function checks that it got imported okay. -# pyparsing will still be in sys.modules even if only part of the import works, so -# this makes sure only a clean import happens or no import at all. - if 'pyparsing' in sys.modules: - del sys.modules['pyparsing'] -else: - OPTS.arg_spec = True - -import pydoc +from pyparsing import Forward, Suppress, QuotedString, dblQuotedString, \ + Group, OneOrMore, ZeroOrMore, Literal, Optional, Word, \ + alphas, alphanums, printables, ParseException +OPTS.arg_spec = True # TODO: #