libv8 7.4.288.28.0beta1 → 7.8.279.23.0beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +0 -1
- data/lib/libv8/version.rb +1 -1
- data/vendor/depot_tools/annotated_gclient.py +2 -4
- data/vendor/depot_tools/auth.py +0 -2
- data/vendor/depot_tools/autoninja +1 -3
- data/vendor/depot_tools/autoninja.bat +1 -1
- data/vendor/depot_tools/autoninja.py +1 -3
- data/vendor/depot_tools/bb +1 -1
- data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
- data/vendor/depot_tools/buildbucket.py +6 -8
- data/vendor/depot_tools/checkout.py +5 -7
- data/vendor/depot_tools/cipd +1 -1
- data/vendor/depot_tools/cipd_manifest.txt +4 -4
- data/vendor/depot_tools/cipd_manifest.versions +80 -80
- data/vendor/depot_tools/cit.py +7 -9
- data/vendor/depot_tools/clang_format.py +1 -4
- data/vendor/depot_tools/clang_format_merge_driver.py +7 -9
- data/vendor/depot_tools/compile_single_file.py +1 -3
- data/vendor/depot_tools/dart_format.py +2 -4
- data/vendor/depot_tools/depot-tools-auth.py +8 -10
- data/vendor/depot_tools/fix_encoding.py +2 -5
- data/vendor/depot_tools/gclient-new-workdir.py +0 -2
- data/vendor/depot_tools/gclient.py +9 -8
- data/vendor/depot_tools/gclient_scm.py +28 -54
- data/vendor/depot_tools/gclient_utils.py +4 -14
- data/vendor/depot_tools/gerrit_util.py +6 -8
- data/vendor/depot_tools/git_cache.py +37 -53
- data/vendor/depot_tools/git_cl.py +42 -115
- data/vendor/depot_tools/git_drover.py +1 -3
- data/vendor/depot_tools/git_find_releases.py +6 -8
- data/vendor/depot_tools/git_footers.py +5 -7
- data/vendor/depot_tools/git_freezer.py +1 -3
- data/vendor/depot_tools/git_map_branches.py +5 -7
- data/vendor/depot_tools/git_mark_merge_base.py +6 -8
- data/vendor/depot_tools/git_nav_downstream.py +5 -7
- data/vendor/depot_tools/git_number.py +1 -3
- data/vendor/depot_tools/git_rebase_update.py +43 -38
- data/vendor/depot_tools/git_reparent_branch.py +6 -8
- data/vendor/depot_tools/git_upstream_diff.py +2 -4
- data/vendor/depot_tools/gn.py +4 -6
- data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
- data/vendor/depot_tools/led +1 -1
- data/vendor/depot_tools/luci-auth +1 -1
- data/vendor/depot_tools/lucicfg +1 -1
- data/vendor/depot_tools/mac_toolchain +1 -1
- data/vendor/depot_tools/man/html/depot_tools.html +1 -1
- data/vendor/depot_tools/man/html/depot_tools_tutorial.html +22 -28
- data/vendor/depot_tools/man/html/git-cl.html +1 -1
- data/vendor/depot_tools/man/html/git-drover.html +18 -18
- data/vendor/depot_tools/man/html/git-footers.html +1 -1
- data/vendor/depot_tools/man/html/git-freeze.html +3 -3
- data/vendor/depot_tools/man/html/git-hyper-blame.html +1 -1
- data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
- data/vendor/depot_tools/man/html/git-map.html +1 -1
- data/vendor/depot_tools/man/html/git-mark-merge-base.html +1 -1
- data/vendor/depot_tools/man/html/git-nav-downstream.html +3 -3
- data/vendor/depot_tools/man/html/git-nav-upstream.html +6 -12
- data/vendor/depot_tools/man/html/git-new-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-rebase-update.html +1 -20
- data/vendor/depot_tools/man/html/git-rename-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-reparent-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-retry.html +1 -1
- data/vendor/depot_tools/man/html/git-squash-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-thaw.html +1 -1
- data/vendor/depot_tools/man/html/git-upstream-diff.html +6 -10
- data/vendor/depot_tools/man/man1/git-cl.1 +4 -4
- data/vendor/depot_tools/man/man1/git-drover.1 +21 -21
- data/vendor/depot_tools/man/man1/git-footers.1 +4 -4
- data/vendor/depot_tools/man/man1/git-freeze.1 +6 -6
- data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
- data/vendor/depot_tools/man/man1/git-map-branches.1 +4 -4
- data/vendor/depot_tools/man/man1/git-map.1 +4 -4
- data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
- data/vendor/depot_tools/man/man1/git-nav-downstream.1 +6 -6
- data/vendor/depot_tools/man/man1/git-nav-upstream.1 +9 -15
- data/vendor/depot_tools/man/man1/git-new-branch.1 +3 -3
- data/vendor/depot_tools/man/man1/git-rebase-update.1 +4 -14
- data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-retry.1 +4 -4
- data/vendor/depot_tools/man/man1/git-squash-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
- data/vendor/depot_tools/man/man1/git-upstream-diff.1 +13 -7
- data/vendor/depot_tools/man/man7/depot_tools.7 +4 -4
- data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +27 -33
- data/vendor/depot_tools/man/src/filter_demo_output.py +1 -3
- data/vendor/depot_tools/man/src/git-rebase-update.txt +0 -7
- data/vendor/depot_tools/my_activity.py +11 -13
- data/vendor/depot_tools/my_reviews.py +29 -34
- data/vendor/depot_tools/ninjalog_uploader_wrapper.py +2 -4
- data/vendor/depot_tools/owners_finder.py +1 -3
- data/vendor/depot_tools/patch.py +1 -1
- data/vendor/depot_tools/post_build_ninja_summary.py +15 -17
- data/vendor/depot_tools/presubmit_canned_checks.py +1 -3
- data/vendor/depot_tools/presubmit_support.py +5 -10
- data/vendor/depot_tools/prpc +1 -1
- data/vendor/depot_tools/recipes/README.recipes.md +17 -17
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +6 -1
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +4 -2
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +6 -1
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/unrecognized_commit_repo.json +5 -0
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-failed.json +4 -2
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_file.json +5 -25
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_mode.json +5 -23
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_verfile.json +5 -23
- data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +6 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +5 -1
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +6 -1
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +5 -0
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +6 -1
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/set_failure_hash_with_no_steps.json +3 -1
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json +6 -4
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json +6 -4
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +6 -4
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +6 -4
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +6 -4
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch_new.json +6 -4
- data/vendor/depot_tools/rietveld.py +1 -3
- data/vendor/depot_tools/roll_dep.py +0 -2
- data/vendor/depot_tools/roll_dep_svn.py +11 -14
- data/vendor/depot_tools/scm.py +5 -10
- data/vendor/depot_tools/split_cl.py +11 -13
- data/vendor/depot_tools/subprocess2.py +1 -1
- data/vendor/depot_tools/third_party/colorama/LICENSE.txt +1 -0
- data/vendor/depot_tools/third_party/colorama/README.chromium +5 -4
- data/vendor/depot_tools/third_party/colorama/README.txt +304 -0
- data/vendor/depot_tools/third_party/colorama/__init__.py +4 -3
- data/vendor/depot_tools/third_party/colorama/ansi.py +30 -82
- data/vendor/depot_tools/third_party/colorama/ansitowin32.py +37 -105
- data/vendor/depot_tools/third_party/colorama/initialise.py +15 -39
- data/vendor/depot_tools/third_party/colorama/win32.py +28 -46
- data/vendor/depot_tools/third_party/colorama/winterm.py +31 -80
- data/vendor/depot_tools/third_party/upload.py +1 -1
- data/vendor/depot_tools/upload_to_google_storage.py +6 -8
- data/vendor/depot_tools/vpython +1 -1
- data/vendor/depot_tools/watchlists.py +3 -5
- data/vendor/depot_tools/weekly +2 -4
- data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +36 -38
- data/vendor/depot_tools/win_toolchain/package_from_installed.py +8 -10
- data/vendor/depot_tools/wtf +3 -5
- metadata +3 -3
- data/vendor/depot_tools/third_party/colorama/README.rst +0 -346
@@ -1,6 +1,7 @@
|
|
1
1
|
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
2
|
-
from .initialise import init, deinit, reinit
|
3
|
-
from .ansi import Fore, Back, Style
|
2
|
+
from .initialise import init, deinit, reinit
|
3
|
+
from .ansi import Fore, Back, Style
|
4
4
|
from .ansitowin32 import AnsiToWin32
|
5
5
|
|
6
|
-
|
6
|
+
VERSION = '0.2.7'
|
7
|
+
|
@@ -5,98 +5,46 @@ See: http://en.wikipedia.org/wiki/ANSI_escape_code
|
|
5
5
|
'''
|
6
6
|
|
7
7
|
CSI = '\033['
|
8
|
-
OSC = '\033]'
|
9
|
-
BEL = '\007'
|
10
|
-
|
11
8
|
|
12
9
|
def code_to_chars(code):
|
13
10
|
return CSI + str(code) + 'm'
|
14
11
|
|
15
|
-
def set_title(title):
|
16
|
-
return OSC + '2;' + title + BEL
|
17
|
-
|
18
|
-
def clear_screen(mode=2):
|
19
|
-
return CSI + str(mode) + 'J'
|
20
|
-
|
21
|
-
def clear_line(mode=2):
|
22
|
-
return CSI + str(mode) + 'K'
|
23
|
-
|
24
|
-
|
25
12
|
class AnsiCodes(object):
|
26
|
-
def __init__(self):
|
27
|
-
|
28
|
-
# Upon instantiation we define instance attributes, which are the same
|
29
|
-
# as the class attributes but wrapped with the ANSI escape sequence
|
30
|
-
for name in dir(self):
|
13
|
+
def __init__(self, codes):
|
14
|
+
for name in dir(codes):
|
31
15
|
if not name.startswith('_'):
|
32
|
-
value = getattr(
|
16
|
+
value = getattr(codes, name)
|
33
17
|
setattr(self, name, code_to_chars(value))
|
34
18
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
RESET = 39
|
59
|
-
|
60
|
-
# These are fairly well supported, but not part of the standard.
|
61
|
-
LIGHTBLACK_EX = 90
|
62
|
-
LIGHTRED_EX = 91
|
63
|
-
LIGHTGREEN_EX = 92
|
64
|
-
LIGHTYELLOW_EX = 93
|
65
|
-
LIGHTBLUE_EX = 94
|
66
|
-
LIGHTMAGENTA_EX = 95
|
67
|
-
LIGHTCYAN_EX = 96
|
68
|
-
LIGHTWHITE_EX = 97
|
69
|
-
|
70
|
-
|
71
|
-
class AnsiBack(AnsiCodes):
|
72
|
-
BLACK = 40
|
73
|
-
RED = 41
|
74
|
-
GREEN = 42
|
75
|
-
YELLOW = 43
|
76
|
-
BLUE = 44
|
77
|
-
MAGENTA = 45
|
78
|
-
CYAN = 46
|
79
|
-
WHITE = 47
|
80
|
-
RESET = 49
|
81
|
-
|
82
|
-
# These are fairly well supported, but not part of the standard.
|
83
|
-
LIGHTBLACK_EX = 100
|
84
|
-
LIGHTRED_EX = 101
|
85
|
-
LIGHTGREEN_EX = 102
|
86
|
-
LIGHTYELLOW_EX = 103
|
87
|
-
LIGHTBLUE_EX = 104
|
88
|
-
LIGHTMAGENTA_EX = 105
|
89
|
-
LIGHTCYAN_EX = 106
|
90
|
-
LIGHTWHITE_EX = 107
|
91
|
-
|
92
|
-
|
93
|
-
class AnsiStyle(AnsiCodes):
|
19
|
+
class AnsiFore:
|
20
|
+
BLACK = 30
|
21
|
+
RED = 31
|
22
|
+
GREEN = 32
|
23
|
+
YELLOW = 33
|
24
|
+
BLUE = 34
|
25
|
+
MAGENTA = 35
|
26
|
+
CYAN = 36
|
27
|
+
WHITE = 37
|
28
|
+
RESET = 39
|
29
|
+
|
30
|
+
class AnsiBack:
|
31
|
+
BLACK = 40
|
32
|
+
RED = 41
|
33
|
+
GREEN = 42
|
34
|
+
YELLOW = 43
|
35
|
+
BLUE = 44
|
36
|
+
MAGENTA = 45
|
37
|
+
CYAN = 46
|
38
|
+
WHITE = 47
|
39
|
+
RESET = 49
|
40
|
+
|
41
|
+
class AnsiStyle:
|
94
42
|
BRIGHT = 1
|
95
43
|
DIM = 2
|
96
44
|
NORMAL = 22
|
97
45
|
RESET_ALL = 0
|
98
46
|
|
99
|
-
Fore
|
100
|
-
Back
|
101
|
-
Style
|
102
|
-
|
47
|
+
Fore = AnsiCodes( AnsiFore )
|
48
|
+
Back = AnsiCodes( AnsiBack )
|
49
|
+
Style = AnsiCodes( AnsiStyle )
|
50
|
+
|
@@ -1,18 +1,20 @@
|
|
1
1
|
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
2
2
|
import re
|
3
3
|
import sys
|
4
|
-
import os
|
5
4
|
|
6
5
|
from .ansi import AnsiFore, AnsiBack, AnsiStyle, Style
|
7
6
|
from .winterm import WinTerm, WinColor, WinStyle
|
8
|
-
from .win32 import windll
|
7
|
+
from .win32 import windll
|
9
8
|
|
10
9
|
|
11
|
-
winterm = None
|
12
10
|
if windll is not None:
|
13
11
|
winterm = WinTerm()
|
14
12
|
|
15
13
|
|
14
|
+
def is_a_tty(stream):
|
15
|
+
return hasattr(stream, 'isatty') and stream.isatty()
|
16
|
+
|
17
|
+
|
16
18
|
class StreamWrapper(object):
|
17
19
|
'''
|
18
20
|
Wraps a stream (such as stdout), acting as a transparent proxy for all
|
@@ -28,38 +30,9 @@ class StreamWrapper(object):
|
|
28
30
|
def __getattr__(self, name):
|
29
31
|
return getattr(self.__wrapped, name)
|
30
32
|
|
31
|
-
def __enter__(self, *args, **kwargs):
|
32
|
-
# special method lookup bypasses __getattr__/__getattribute__, see
|
33
|
-
# https://stackoverflow.com/questions/12632894/why-doesnt-getattr-work-with-exit
|
34
|
-
# thus, contextlib magic methods are not proxied via __getattr__
|
35
|
-
return self.__wrapped.__enter__(*args, **kwargs)
|
36
|
-
|
37
|
-
def __exit__(self, *args, **kwargs):
|
38
|
-
return self.__wrapped.__exit__(*args, **kwargs)
|
39
|
-
|
40
33
|
def write(self, text):
|
41
34
|
self.__convertor.write(text)
|
42
35
|
|
43
|
-
def isatty(self):
|
44
|
-
stream = self.__wrapped
|
45
|
-
if 'PYCHARM_HOSTED' in os.environ:
|
46
|
-
if stream is not None and (stream is sys.__stdout__ or stream is sys.__stderr__):
|
47
|
-
return True
|
48
|
-
try:
|
49
|
-
stream_isatty = stream.isatty
|
50
|
-
except AttributeError:
|
51
|
-
return False
|
52
|
-
else:
|
53
|
-
return stream_isatty()
|
54
|
-
|
55
|
-
@property
|
56
|
-
def closed(self):
|
57
|
-
stream = self.__wrapped
|
58
|
-
try:
|
59
|
-
return stream.closed
|
60
|
-
except AttributeError:
|
61
|
-
return True
|
62
|
-
|
63
36
|
|
64
37
|
class AnsiToWin32(object):
|
65
38
|
'''
|
@@ -67,8 +40,7 @@ class AnsiToWin32(object):
|
|
67
40
|
sequences from the text, and if outputting to a tty, will convert them into
|
68
41
|
win32 function calls.
|
69
42
|
'''
|
70
|
-
|
71
|
-
ANSI_OSC_RE = re.compile('\001?\033\\]((?:.|;)*?)(\x07)\002?') # Operating System Command
|
43
|
+
ANSI_RE = re.compile('\033\[((?:\d|;)*)([a-zA-Z])')
|
72
44
|
|
73
45
|
def __init__(self, wrapped, convert=None, strip=None, autoreset=False):
|
74
46
|
# The wrapped stream (normally sys.stdout or sys.stderr)
|
@@ -80,21 +52,16 @@ class AnsiToWin32(object):
|
|
80
52
|
# create the proxy wrapping our output stream
|
81
53
|
self.stream = StreamWrapper(wrapped, self)
|
82
54
|
|
83
|
-
on_windows =
|
84
|
-
# We test if the WinAPI works, because even if we are on Windows
|
85
|
-
# we may be using a terminal that doesn't support the WinAPI
|
86
|
-
# (e.g. Cygwin Terminal). In this case it's up to the terminal
|
87
|
-
# to support the ANSI codes.
|
88
|
-
conversion_supported = on_windows and winapi_test()
|
55
|
+
on_windows = sys.platform.startswith('win')
|
89
56
|
|
90
57
|
# should we strip ANSI sequences from our output?
|
91
58
|
if strip is None:
|
92
|
-
strip =
|
59
|
+
strip = on_windows
|
93
60
|
self.strip = strip
|
94
61
|
|
95
62
|
# should we should convert ANSI sequences into win32 calls?
|
96
63
|
if convert is None:
|
97
|
-
convert =
|
64
|
+
convert = on_windows and is_a_tty(wrapped)
|
98
65
|
self.convert = convert
|
99
66
|
|
100
67
|
# dict of ansi codes to win32 functions and parameters
|
@@ -103,6 +70,7 @@ class AnsiToWin32(object):
|
|
103
70
|
# are we wrapping stderr?
|
104
71
|
self.on_stderr = self.wrapped is sys.stderr
|
105
72
|
|
73
|
+
|
106
74
|
def should_wrap(self):
|
107
75
|
'''
|
108
76
|
True if this class is actually needed. If false, then the output
|
@@ -113,6 +81,7 @@ class AnsiToWin32(object):
|
|
113
81
|
'''
|
114
82
|
return self.convert or self.strip or self.autoreset
|
115
83
|
|
84
|
+
|
116
85
|
def get_win32_calls(self):
|
117
86
|
if self.convert and winterm:
|
118
87
|
return {
|
@@ -129,14 +98,6 @@ class AnsiToWin32(object):
|
|
129
98
|
AnsiFore.CYAN: (winterm.fore, WinColor.CYAN),
|
130
99
|
AnsiFore.WHITE: (winterm.fore, WinColor.GREY),
|
131
100
|
AnsiFore.RESET: (winterm.fore, ),
|
132
|
-
AnsiFore.LIGHTBLACK_EX: (winterm.fore, WinColor.BLACK, True),
|
133
|
-
AnsiFore.LIGHTRED_EX: (winterm.fore, WinColor.RED, True),
|
134
|
-
AnsiFore.LIGHTGREEN_EX: (winterm.fore, WinColor.GREEN, True),
|
135
|
-
AnsiFore.LIGHTYELLOW_EX: (winterm.fore, WinColor.YELLOW, True),
|
136
|
-
AnsiFore.LIGHTBLUE_EX: (winterm.fore, WinColor.BLUE, True),
|
137
|
-
AnsiFore.LIGHTMAGENTA_EX: (winterm.fore, WinColor.MAGENTA, True),
|
138
|
-
AnsiFore.LIGHTCYAN_EX: (winterm.fore, WinColor.CYAN, True),
|
139
|
-
AnsiFore.LIGHTWHITE_EX: (winterm.fore, WinColor.GREY, True),
|
140
101
|
AnsiBack.BLACK: (winterm.back, WinColor.BLACK),
|
141
102
|
AnsiBack.RED: (winterm.back, WinColor.RED),
|
142
103
|
AnsiBack.GREEN: (winterm.back, WinColor.GREEN),
|
@@ -146,16 +107,8 @@ class AnsiToWin32(object):
|
|
146
107
|
AnsiBack.CYAN: (winterm.back, WinColor.CYAN),
|
147
108
|
AnsiBack.WHITE: (winterm.back, WinColor.GREY),
|
148
109
|
AnsiBack.RESET: (winterm.back, ),
|
149
|
-
AnsiBack.LIGHTBLACK_EX: (winterm.back, WinColor.BLACK, True),
|
150
|
-
AnsiBack.LIGHTRED_EX: (winterm.back, WinColor.RED, True),
|
151
|
-
AnsiBack.LIGHTGREEN_EX: (winterm.back, WinColor.GREEN, True),
|
152
|
-
AnsiBack.LIGHTYELLOW_EX: (winterm.back, WinColor.YELLOW, True),
|
153
|
-
AnsiBack.LIGHTBLUE_EX: (winterm.back, WinColor.BLUE, True),
|
154
|
-
AnsiBack.LIGHTMAGENTA_EX: (winterm.back, WinColor.MAGENTA, True),
|
155
|
-
AnsiBack.LIGHTCYAN_EX: (winterm.back, WinColor.CYAN, True),
|
156
|
-
AnsiBack.LIGHTWHITE_EX: (winterm.back, WinColor.GREY, True),
|
157
110
|
}
|
158
|
-
|
111
|
+
|
159
112
|
|
160
113
|
def write(self, text):
|
161
114
|
if self.strip or self.convert:
|
@@ -170,7 +123,7 @@ class AnsiToWin32(object):
|
|
170
123
|
def reset_all(self):
|
171
124
|
if self.convert:
|
172
125
|
self.call_win32('m', (0,))
|
173
|
-
elif
|
126
|
+
elif is_a_tty(self.wrapped):
|
174
127
|
self.wrapped.write(Style.RESET_ALL)
|
175
128
|
|
176
129
|
|
@@ -181,8 +134,7 @@ class AnsiToWin32(object):
|
|
181
134
|
calls.
|
182
135
|
'''
|
183
136
|
cursor = 0
|
184
|
-
|
185
|
-
for match in self.ANSI_CSI_RE.finditer(text):
|
137
|
+
for match in self.ANSI_RE.finditer(text):
|
186
138
|
start, end = match.span()
|
187
139
|
self.write_plain_text(text, cursor, start)
|
188
140
|
self.convert_ansi(*match.groups())
|
@@ -198,29 +150,21 @@ class AnsiToWin32(object):
|
|
198
150
|
|
199
151
|
def convert_ansi(self, paramstring, command):
|
200
152
|
if self.convert:
|
201
|
-
params = self.extract_params(
|
153
|
+
params = self.extract_params(paramstring)
|
202
154
|
self.call_win32(command, params)
|
203
155
|
|
204
156
|
|
205
|
-
def extract_params(self,
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
else:
|
212
|
-
params = tuple(int(p) for p in paramstring.split(';') if len(p) != 0)
|
213
|
-
if len(params) == 0:
|
214
|
-
# defaults:
|
215
|
-
if command in 'JKm':
|
216
|
-
params = (0,)
|
217
|
-
elif command in 'ABCD':
|
218
|
-
params = (1,)
|
219
|
-
|
220
|
-
return params
|
157
|
+
def extract_params(self, paramstring):
|
158
|
+
def split(paramstring):
|
159
|
+
for p in paramstring.split(';'):
|
160
|
+
if p != '':
|
161
|
+
yield int(p)
|
162
|
+
return tuple(split(paramstring))
|
221
163
|
|
222
164
|
|
223
165
|
def call_win32(self, command, params):
|
166
|
+
if params == []:
|
167
|
+
params = [0]
|
224
168
|
if command == 'm':
|
225
169
|
for param in params:
|
226
170
|
if param in self.win32_calls:
|
@@ -229,29 +173,17 @@ class AnsiToWin32(object):
|
|
229
173
|
args = func_args[1:]
|
230
174
|
kwargs = dict(on_stderr=self.on_stderr)
|
231
175
|
func(*args, **kwargs)
|
232
|
-
elif command in '
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
elif command
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
for match in self.ANSI_OSC_RE.finditer(text):
|
247
|
-
start, end = match.span()
|
248
|
-
text = text[:start] + text[end:]
|
249
|
-
paramstring, command = match.groups()
|
250
|
-
if command in '\x07': # \x07 = BEL
|
251
|
-
params = paramstring.split(";")
|
252
|
-
# 0 - change title and icon (we will only change title)
|
253
|
-
# 1 - change icon (we don't support this)
|
254
|
-
# 2 - change title
|
255
|
-
if params[0] in '02':
|
256
|
-
winterm.set_title(params[1])
|
257
|
-
return text
|
176
|
+
elif command in ('H', 'f'): # set cursor position
|
177
|
+
func = winterm.set_cursor_position
|
178
|
+
func(params, on_stderr=self.on_stderr)
|
179
|
+
elif command in ('J'):
|
180
|
+
func = winterm.erase_data
|
181
|
+
func(params, on_stderr=self.on_stderr)
|
182
|
+
elif command == 'A':
|
183
|
+
if params == () or params == None:
|
184
|
+
num_rows = 1
|
185
|
+
else:
|
186
|
+
num_rows = params[0]
|
187
|
+
func = winterm.cursor_up
|
188
|
+
func(num_rows, on_stderr=self.on_stderr)
|
189
|
+
|
@@ -1,23 +1,21 @@
|
|
1
1
|
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
|
2
2
|
import atexit
|
3
|
-
import contextlib
|
4
3
|
import sys
|
5
4
|
|
6
5
|
from .ansitowin32 import AnsiToWin32
|
7
6
|
|
8
7
|
|
9
|
-
orig_stdout =
|
10
|
-
orig_stderr =
|
8
|
+
orig_stdout = sys.stdout
|
9
|
+
orig_stderr = sys.stderr
|
11
10
|
|
12
|
-
wrapped_stdout =
|
13
|
-
wrapped_stderr =
|
11
|
+
wrapped_stdout = sys.stdout
|
12
|
+
wrapped_stderr = sys.stderr
|
14
13
|
|
15
14
|
atexit_done = False
|
16
15
|
|
17
16
|
|
18
17
|
def reset_all():
|
19
|
-
|
20
|
-
AnsiToWin32(orig_stdout).reset_all()
|
18
|
+
AnsiToWin32(orig_stdout).reset_all()
|
21
19
|
|
22
20
|
|
23
21
|
def init(autoreset=False, convert=None, strip=None, wrap=True):
|
@@ -26,21 +24,10 @@ def init(autoreset=False, convert=None, strip=None, wrap=True):
|
|
26
24
|
raise ValueError('wrap=False conflicts with any other arg=True')
|
27
25
|
|
28
26
|
global wrapped_stdout, wrapped_stderr
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
if sys.stdout is None:
|
35
|
-
wrapped_stdout = None
|
36
|
-
else:
|
37
|
-
sys.stdout = wrapped_stdout = \
|
38
|
-
wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
|
39
|
-
if sys.stderr is None:
|
40
|
-
wrapped_stderr = None
|
41
|
-
else:
|
42
|
-
sys.stderr = wrapped_stderr = \
|
43
|
-
wrap_stream(orig_stderr, convert, strip, autoreset, wrap)
|
27
|
+
sys.stdout = wrapped_stdout = \
|
28
|
+
wrap_stream(orig_stdout, convert, strip, autoreset, wrap)
|
29
|
+
sys.stderr = wrapped_stderr = \
|
30
|
+
wrap_stream(orig_stderr, convert, strip, autoreset, wrap)
|
44
31
|
|
45
32
|
global atexit_done
|
46
33
|
if not atexit_done:
|
@@ -49,26 +36,13 @@ def init(autoreset=False, convert=None, strip=None, wrap=True):
|
|
49
36
|
|
50
37
|
|
51
38
|
def deinit():
|
52
|
-
|
53
|
-
|
54
|
-
if orig_stderr is not None:
|
55
|
-
sys.stderr = orig_stderr
|
56
|
-
|
57
|
-
|
58
|
-
@contextlib.contextmanager
|
59
|
-
def colorama_text(*args, **kwargs):
|
60
|
-
init(*args, **kwargs)
|
61
|
-
try:
|
62
|
-
yield
|
63
|
-
finally:
|
64
|
-
deinit()
|
39
|
+
sys.stdout = orig_stdout
|
40
|
+
sys.stderr = orig_stderr
|
65
41
|
|
66
42
|
|
67
43
|
def reinit():
|
68
|
-
|
69
|
-
|
70
|
-
if wrapped_stderr is not None:
|
71
|
-
sys.stderr = wrapped_stderr
|
44
|
+
sys.stdout = wrapped_stdout
|
45
|
+
sys.stderr = wrapped_stdout
|
72
46
|
|
73
47
|
|
74
48
|
def wrap_stream(stream, convert, strip, autoreset, wrap):
|
@@ -78,3 +52,5 @@ def wrap_stream(stream, convert, strip, autoreset, wrap):
|
|
78
52
|
if wrapper.should_wrap():
|
79
53
|
stream = wrapper.stream
|
80
54
|
return stream
|
55
|
+
|
56
|
+
|