mirror of
https://github.com/kennethreitz-archive/bpython-gist.git
synced 2026-06-05 23:50:18 +00:00
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.
This commit is contained in:
+9
-25
@@ -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:
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user