Bugfix opening files which need the pygments plugin. Py2 comp.

Wed, 13 Nov 2013 23:30:59 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Wed, 13 Nov 2013 23:30:59 +0100
branch
Py2 comp.
changeset 3079
0233bbe9a9c4
parent 3066
76a310bc7bba
child 3080
6c0a430b19df

Bugfix opening files which need the pygments plugin.

ThirdParty/Pygments/pygments/formatter.py file | annotate | diff | comparison | revisions
ThirdParty/Pygments/pygments/formatters/html.py file | annotate | diff | comparison | revisions
ThirdParty/Pygments/pygments/formatters/latex.py file | annotate | diff | comparison | revisions
ThirdParty/Pygments/pygments/formatters/rtf.py file | annotate | diff | comparison | revisions
ThirdParty/Pygments/pygments/lexer.py file | annotate | diff | comparison | revisions
ThirdParty/Pygments/pygments/style.py file | annotate | diff | comparison | revisions
--- a/ThirdParty/Pygments/pygments/formatter.py	Wed Nov 06 19:50:24 2013 +0100
+++ b/ThirdParty/Pygments/pygments/formatter.py	Wed Nov 13 23:30:59 2013 +0100
@@ -11,6 +11,11 @@
 
 from __future__ import unicode_literals    # __IGNORE_WARNING__
 
+try:
+    basestring    # __IGNORE_WARNING__
+except NameError:
+    basestring = str
+
 import codecs
 
 from pygments.util import get_bool_opt
@@ -20,7 +25,7 @@
 
 
 def _lookup_style(style):
-    if isinstance(style, str):
+    if isinstance(style, basestring):
         return get_style_by_name(style)
     return style
 
--- a/ThirdParty/Pygments/pygments/formatters/html.py	Wed Nov 06 19:50:24 2013 +0100
+++ b/ThirdParty/Pygments/pygments/formatters/html.py	Wed Nov 13 23:30:59 2013 +0100
@@ -9,7 +9,10 @@
     :license: BSD, see LICENSE for details.
 """
 
-from __future__ import unicode_literals    # __IGNORE_WARNING__
+try:
+    basestring    # __IGNORE_WARNING__
+except NameError:
+    basestring = str
 
 import os
 import sys
@@ -455,7 +458,7 @@
         """
         if arg is None:
             arg = ('cssclass' in self.options and '.'+self.cssclass or '')
-        if isinstance(arg, str):
+        if isinstance(arg, basestring):
             args = [arg]
         else:
             args = list(arg)
@@ -507,8 +510,8 @@
                     cssfilename = os.path.join(os.path.dirname(filename),
                                                self.cssfile)
                 except AttributeError:
-                    print('Note: Cannot determine output file name, ' \
-                          'using current directory as base for the CSS file name', file=sys.stderr)
+                    sys.stderr.write('Note: Cannot determine output file name, ' \
+                          'using current directory as base for the CSS file name')
                     cssfilename = self.cssfile
             # write CSS file only if noclobber_cssfile isn't given as an option.
             try:
--- a/ThirdParty/Pygments/pygments/formatters/latex.py	Wed Nov 06 19:50:24 2013 +0100
+++ b/ThirdParty/Pygments/pygments/formatters/latex.py	Wed Nov 13 23:30:59 2013 +0100
@@ -9,8 +9,6 @@
     :license: BSD, see LICENSE for details.
 """
 
-from __future__ import unicode_literals    # __IGNORE_WARNING__
-
 from pygments.formatter import Formatter
 from pygments.token import Token, STANDARD_TYPES
 from pygments.util import get_bool_opt, get_int_opt, StringIO
--- a/ThirdParty/Pygments/pygments/formatters/rtf.py	Wed Nov 06 19:50:24 2013 +0100
+++ b/ThirdParty/Pygments/pygments/formatters/rtf.py	Wed Nov 13 23:30:59 2013 +0100
@@ -9,8 +9,6 @@
     :license: BSD, see LICENSE for details.
 """
 
-from __future__ import unicode_literals    # __IGNORE_WARNING__
-
 from pygments.formatter import Formatter
 
 
--- a/ThirdParty/Pygments/pygments/lexer.py	Wed Nov 06 19:50:24 2013 +0100
+++ b/ThirdParty/Pygments/pygments/lexer.py	Wed Nov 13 23:30:59 2013 +0100
@@ -11,7 +11,7 @@
 try:
     str = unicode   # __IGNORE_WARNING__
 except (NameError):
-    pass
+    basestring = str
 
 import re, itertools
 
@@ -409,7 +409,7 @@
 
     def _process_new_state(cls, new_state, unprocessed, processed):
         """Preprocess the state transition action of a token definition."""
-        if isinstance(new_state, str):
+        if isinstance(new_state, basestring):
             # an existing state
             if new_state == '#pop':
                 return -1
@@ -444,7 +444,7 @@
 
     def _process_state(cls, unprocessed, processed, state):
         """Preprocess a single state definition."""
-        assert type(state) is str, "wrong state name %r" % state
+        assert isinstance(state, basestring), "wrong state name %r" % state
         assert state[0] != '#', "invalid state name %r" % state
         if state in processed:
             return processed[state]
--- a/ThirdParty/Pygments/pygments/style.py	Wed Nov 06 19:50:24 2013 +0100
+++ b/ThirdParty/Pygments/pygments/style.py	Wed Nov 13 23:30:59 2013 +0100
@@ -9,8 +9,6 @@
     :license: BSD, see LICENSE for details.
 """
 
-from __future__ import unicode_literals    # __IGNORE_WARNING__
-
 from pygments.token import Token, STANDARD_TYPES
 
 def with_metaclass(meta, base=object):
@@ -22,6 +20,13 @@
 
 
 class StyleMeta(type):
+    background_color = '#ffffff'
+
+    #: highlight background color
+    highlight_color = '#ffffcc'
+
+    #: Style definitions for individual token types.
+    styles = {}
 
     def __new__(mcs, name, bases, dct):
         obj = type.__new__(mcs, name, bases, dct)
@@ -114,10 +119,4 @@
 
 
 class Style(with_metaclass(StyleMeta, object)):
-    background_color = '#ffffff'
-
-    #: highlight background color
-    highlight_color = '#ffffcc'
-
-    #: Style definitions for individual token types.
-    styles = {}
+    pass

eric ide

mercurial