Show More
@@ -87,21 +87,31 b' except (ImportError, AttributeError):' | |||||
87 | processlock = threading.Lock() |
|
87 | processlock = threading.Lock() | |
88 |
|
88 | |||
89 | pygmentspresent = False |
|
89 | pygmentspresent = False | |
90 | # ANSI color is unsupported prior to Windows 10 |
|
90 | try: # is pygments installed | |
91 | if os.name != 'nt': |
|
91 | import pygments | |
92 | try: # is pygments installed |
|
92 | import pygments.lexers as lexers | |
93 |
|
|
93 | import pygments.lexer as lexer | |
94 |
|
|
94 | import pygments.formatters as formatters | |
95 |
|
|
95 | import pygments.token as token | |
96 |
|
|
96 | import pygments.style as style | |
97 | import pygments.token as token |
|
97 | ||
98 | import pygments.style as style |
|
98 | if os.name == 'nt': | |
99 |
|
99 | hgpath = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
100 | pygmentspresent = True |
|
100 | sys.path.append(hgpath) | |
101 | difflexer = lexers.DiffLexer() |
|
101 | try: | |
102 | terminal256formatter = formatters.Terminal256Formatter() |
|
102 | from mercurial import win32 # pytype: disable=import-error | |
103 | except ImportError: |
|
103 | ||
104 | pass |
|
104 | # Don't check the result code because it fails on heptapod, but | |
|
105 | # something is able to convert to color anyway. | |||
|
106 | win32.enablevtmode() | |||
|
107 | finally: | |||
|
108 | sys.path = sys.path[:-1] | |||
|
109 | ||||
|
110 | pygmentspresent = True | |||
|
111 | difflexer = lexers.DiffLexer() | |||
|
112 | terminal256formatter = formatters.Terminal256Formatter() | |||
|
113 | except ImportError: | |||
|
114 | pass | |||
105 |
|
115 | |||
106 | if pygmentspresent: |
|
116 | if pygmentspresent: | |
107 |
|
117 |
General Comments 0
You need to be logged in to leave comments.
Login now