libv8 7.3.492.27.3beta1 → 7.4.288.28.0beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +1 -0
  3. data/lib/libv8/version.rb +1 -1
  4. data/vendor/depot_tools/annotated_gclient.py +4 -2
  5. data/vendor/depot_tools/auth.py +2 -0
  6. data/vendor/depot_tools/autoninja +3 -1
  7. data/vendor/depot_tools/autoninja.bat +1 -1
  8. data/vendor/depot_tools/autoninja.py +3 -1
  9. data/vendor/depot_tools/bb +1 -1
  10. data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
  11. data/vendor/depot_tools/buildbucket.py +8 -6
  12. data/vendor/depot_tools/checkout.py +7 -5
  13. data/vendor/depot_tools/cipd +1 -1
  14. data/vendor/depot_tools/cipd_manifest.txt +4 -4
  15. data/vendor/depot_tools/cipd_manifest.versions +80 -80
  16. data/vendor/depot_tools/cit.py +9 -7
  17. data/vendor/depot_tools/clang_format.py +4 -1
  18. data/vendor/depot_tools/clang_format_merge_driver.py +9 -7
  19. data/vendor/depot_tools/compile_single_file.py +3 -1
  20. data/vendor/depot_tools/dart_format.py +4 -2
  21. data/vendor/depot_tools/depot-tools-auth.py +10 -8
  22. data/vendor/depot_tools/fix_encoding.py +5 -2
  23. data/vendor/depot_tools/gclient-new-workdir.py +2 -0
  24. data/vendor/depot_tools/gclient.py +8 -9
  25. data/vendor/depot_tools/gclient_scm.py +54 -28
  26. data/vendor/depot_tools/gclient_utils.py +14 -4
  27. data/vendor/depot_tools/gerrit_util.py +8 -6
  28. data/vendor/depot_tools/git_cache.py +53 -37
  29. data/vendor/depot_tools/git_cl.py +115 -42
  30. data/vendor/depot_tools/git_drover.py +3 -1
  31. data/vendor/depot_tools/git_find_releases.py +8 -6
  32. data/vendor/depot_tools/git_footers.py +7 -5
  33. data/vendor/depot_tools/git_freezer.py +3 -1
  34. data/vendor/depot_tools/git_map_branches.py +7 -5
  35. data/vendor/depot_tools/git_mark_merge_base.py +8 -6
  36. data/vendor/depot_tools/git_nav_downstream.py +7 -5
  37. data/vendor/depot_tools/git_number.py +3 -1
  38. data/vendor/depot_tools/git_rebase_update.py +38 -43
  39. data/vendor/depot_tools/git_reparent_branch.py +8 -6
  40. data/vendor/depot_tools/git_upstream_diff.py +4 -2
  41. data/vendor/depot_tools/gn.py +6 -4
  42. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  43. data/vendor/depot_tools/led +1 -1
  44. data/vendor/depot_tools/luci-auth +1 -1
  45. data/vendor/depot_tools/lucicfg +1 -1
  46. data/vendor/depot_tools/mac_toolchain +1 -1
  47. data/vendor/depot_tools/man/html/depot_tools.html +1 -1
  48. data/vendor/depot_tools/man/html/depot_tools_tutorial.html +28 -22
  49. data/vendor/depot_tools/man/html/git-cl.html +1 -1
  50. data/vendor/depot_tools/man/html/git-drover.html +18 -18
  51. data/vendor/depot_tools/man/html/git-footers.html +1 -1
  52. data/vendor/depot_tools/man/html/git-freeze.html +3 -3
  53. data/vendor/depot_tools/man/html/git-hyper-blame.html +1 -1
  54. data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
  55. data/vendor/depot_tools/man/html/git-map.html +1 -1
  56. data/vendor/depot_tools/man/html/git-mark-merge-base.html +1 -1
  57. data/vendor/depot_tools/man/html/git-nav-downstream.html +3 -3
  58. data/vendor/depot_tools/man/html/git-nav-upstream.html +12 -6
  59. data/vendor/depot_tools/man/html/git-new-branch.html +1 -1
  60. data/vendor/depot_tools/man/html/git-rebase-update.html +20 -1
  61. data/vendor/depot_tools/man/html/git-rename-branch.html +1 -1
  62. data/vendor/depot_tools/man/html/git-reparent-branch.html +1 -1
  63. data/vendor/depot_tools/man/html/git-retry.html +1 -1
  64. data/vendor/depot_tools/man/html/git-squash-branch.html +1 -1
  65. data/vendor/depot_tools/man/html/git-thaw.html +1 -1
  66. data/vendor/depot_tools/man/html/git-upstream-diff.html +10 -6
  67. data/vendor/depot_tools/man/man1/git-cl.1 +4 -4
  68. data/vendor/depot_tools/man/man1/git-drover.1 +21 -21
  69. data/vendor/depot_tools/man/man1/git-footers.1 +4 -4
  70. data/vendor/depot_tools/man/man1/git-freeze.1 +6 -6
  71. data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
  72. data/vendor/depot_tools/man/man1/git-map-branches.1 +4 -4
  73. data/vendor/depot_tools/man/man1/git-map.1 +4 -4
  74. data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
  75. data/vendor/depot_tools/man/man1/git-nav-downstream.1 +6 -6
  76. data/vendor/depot_tools/man/man1/git-nav-upstream.1 +15 -9
  77. data/vendor/depot_tools/man/man1/git-new-branch.1 +3 -3
  78. data/vendor/depot_tools/man/man1/git-rebase-update.1 +14 -4
  79. data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
  80. data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
  81. data/vendor/depot_tools/man/man1/git-retry.1 +4 -4
  82. data/vendor/depot_tools/man/man1/git-squash-branch.1 +4 -4
  83. data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
  84. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +7 -13
  85. data/vendor/depot_tools/man/man7/depot_tools.7 +4 -4
  86. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +33 -27
  87. data/vendor/depot_tools/man/src/filter_demo_output.py +3 -1
  88. data/vendor/depot_tools/man/src/git-rebase-update.txt +7 -0
  89. data/vendor/depot_tools/my_activity.py +13 -11
  90. data/vendor/depot_tools/my_reviews.py +34 -29
  91. data/vendor/depot_tools/ninjalog_uploader_wrapper.py +4 -2
  92. data/vendor/depot_tools/owners_finder.py +3 -1
  93. data/vendor/depot_tools/patch.py +1 -1
  94. data/vendor/depot_tools/post_build_ninja_summary.py +17 -15
  95. data/vendor/depot_tools/presubmit_canned_checks.py +3 -1
  96. data/vendor/depot_tools/presubmit_support.py +10 -5
  97. data/vendor/depot_tools/prpc +1 -1
  98. data/vendor/depot_tools/recipes/README.recipes.md +17 -17
  99. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +1 -6
  100. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +2 -4
  101. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +1 -6
  102. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/unrecognized_commit_repo.json +0 -5
  103. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-failed.json +2 -4
  104. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_file.json +25 -5
  105. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_mode.json +23 -5
  106. data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_verfile.json +23 -5
  107. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +0 -6
  108. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +0 -1
  109. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +1 -5
  110. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +1 -6
  111. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +0 -5
  112. data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +1 -6
  113. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/set_failure_hash_with_no_steps.json +1 -3
  114. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json +4 -6
  115. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json +4 -6
  116. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +4 -6
  117. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +4 -6
  118. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +4 -6
  119. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch_new.json +4 -6
  120. data/vendor/depot_tools/rietveld.py +3 -1
  121. data/vendor/depot_tools/roll_dep.py +2 -0
  122. data/vendor/depot_tools/roll_dep_svn.py +14 -11
  123. data/vendor/depot_tools/scm.py +10 -5
  124. data/vendor/depot_tools/split_cl.py +13 -11
  125. data/vendor/depot_tools/subprocess2.py +1 -1
  126. data/vendor/depot_tools/third_party/colorama/LICENSE.txt +0 -1
  127. data/vendor/depot_tools/third_party/colorama/README.chromium +4 -5
  128. data/vendor/depot_tools/third_party/colorama/README.rst +346 -0
  129. data/vendor/depot_tools/third_party/colorama/__init__.py +3 -4
  130. data/vendor/depot_tools/third_party/colorama/ansi.py +82 -30
  131. data/vendor/depot_tools/third_party/colorama/ansitowin32.py +105 -37
  132. data/vendor/depot_tools/third_party/colorama/initialise.py +39 -15
  133. data/vendor/depot_tools/third_party/colorama/win32.py +46 -28
  134. data/vendor/depot_tools/third_party/colorama/winterm.py +80 -31
  135. data/vendor/depot_tools/third_party/upload.py +1 -1
  136. data/vendor/depot_tools/upload_to_google_storage.py +8 -6
  137. data/vendor/depot_tools/vpython +1 -1
  138. data/vendor/depot_tools/watchlists.py +5 -3
  139. data/vendor/depot_tools/weekly +4 -2
  140. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +38 -36
  141. data/vendor/depot_tools/win_toolchain/package_from_installed.py +10 -8
  142. data/vendor/depot_tools/wtf +5 -3
  143. metadata +3 -3
  144. data/vendor/depot_tools/third_party/colorama/README.txt +0 -304
@@ -5,24 +5,27 @@ STDOUT = -11
5
5
  STDERR = -12
6
6
 
7
7
  try:
8
- from ctypes import windll
8
+ import ctypes
9
+ from ctypes import LibraryLoader
10
+ windll = LibraryLoader(ctypes.WinDLL)
9
11
  from ctypes import wintypes
10
- except ImportError:
12
+ except (AttributeError, ImportError):
11
13
  windll = None
12
14
  SetConsoleTextAttribute = lambda *_: None
15
+ winapi_test = lambda *_: None
13
16
  else:
14
- from ctypes import (
15
- byref, Structure, c_char, c_short, c_uint32, c_ushort, POINTER
16
- )
17
+ from ctypes import byref, Structure, c_char, POINTER
18
+
19
+ COORD = wintypes._COORD
17
20
 
18
21
  class CONSOLE_SCREEN_BUFFER_INFO(Structure):
19
22
  """struct in wincon.h."""
20
23
  _fields_ = [
21
- ("dwSize", wintypes._COORD),
22
- ("dwCursorPosition", wintypes._COORD),
24
+ ("dwSize", COORD),
25
+ ("dwCursorPosition", COORD),
23
26
  ("wAttributes", wintypes.WORD),
24
27
  ("srWindow", wintypes.SMALL_RECT),
25
- ("dwMaximumWindowSize", wintypes._COORD),
28
+ ("dwMaximumWindowSize", COORD),
26
29
  ]
27
30
  def __str__(self):
28
31
  return '(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)' % (
@@ -56,7 +59,7 @@ else:
56
59
  _SetConsoleCursorPosition = windll.kernel32.SetConsoleCursorPosition
57
60
  _SetConsoleCursorPosition.argtypes = [
58
61
  wintypes.HANDLE,
59
- wintypes._COORD,
62
+ COORD,
60
63
  ]
61
64
  _SetConsoleCursorPosition.restype = wintypes.BOOL
62
65
 
@@ -65,7 +68,7 @@ else:
65
68
  wintypes.HANDLE,
66
69
  c_char,
67
70
  wintypes.DWORD,
68
- wintypes._COORD,
71
+ COORD,
69
72
  POINTER(wintypes.DWORD),
70
73
  ]
71
74
  _FillConsoleOutputCharacterA.restype = wintypes.BOOL
@@ -75,47 +78,59 @@ else:
75
78
  wintypes.HANDLE,
76
79
  wintypes.WORD,
77
80
  wintypes.DWORD,
78
- wintypes._COORD,
81
+ COORD,
79
82
  POINTER(wintypes.DWORD),
80
83
  ]
81
84
  _FillConsoleOutputAttribute.restype = wintypes.BOOL
82
85
 
83
- handles = {
84
- STDOUT: _GetStdHandle(STDOUT),
85
- STDERR: _GetStdHandle(STDERR),
86
- }
86
+ _SetConsoleTitleW = windll.kernel32.SetConsoleTitleW
87
+ _SetConsoleTitleW.argtypes = [
88
+ wintypes.LPCWSTR
89
+ ]
90
+ _SetConsoleTitleW.restype = wintypes.BOOL
91
+
92
+ def _winapi_test(handle):
93
+ csbi = CONSOLE_SCREEN_BUFFER_INFO()
94
+ success = _GetConsoleScreenBufferInfo(
95
+ handle, byref(csbi))
96
+ return bool(success)
97
+
98
+ def winapi_test():
99
+ return any(_winapi_test(h) for h in
100
+ (_GetStdHandle(STDOUT), _GetStdHandle(STDERR)))
87
101
 
88
102
  def GetConsoleScreenBufferInfo(stream_id=STDOUT):
89
- handle = handles[stream_id]
103
+ handle = _GetStdHandle(stream_id)
90
104
  csbi = CONSOLE_SCREEN_BUFFER_INFO()
91
105
  success = _GetConsoleScreenBufferInfo(
92
106
  handle, byref(csbi))
93
107
  return csbi
94
108
 
95
109
  def SetConsoleTextAttribute(stream_id, attrs):
96
- handle = handles[stream_id]
110
+ handle = _GetStdHandle(stream_id)
97
111
  return _SetConsoleTextAttribute(handle, attrs)
98
112
 
99
- def SetConsoleCursorPosition(stream_id, position):
100
- position = wintypes._COORD(*position)
113
+ def SetConsoleCursorPosition(stream_id, position, adjust=True):
114
+ position = COORD(*position)
101
115
  # If the position is out of range, do nothing.
102
116
  if position.Y <= 0 or position.X <= 0:
103
117
  return
104
118
  # Adjust for Windows' SetConsoleCursorPosition:
105
119
  # 1. being 0-based, while ANSI is 1-based.
106
120
  # 2. expecting (x,y), while ANSI uses (y,x).
107
- adjusted_position = wintypes._COORD(position.Y - 1, position.X - 1)
108
- # Adjust for viewport's scroll position
109
- sr = GetConsoleScreenBufferInfo(STDOUT).srWindow
110
- adjusted_position.Y += sr.Top
111
- adjusted_position.X += sr.Left
121
+ adjusted_position = COORD(position.Y - 1, position.X - 1)
122
+ if adjust:
123
+ # Adjust for viewport's scroll position
124
+ sr = GetConsoleScreenBufferInfo(STDOUT).srWindow
125
+ adjusted_position.Y += sr.Top
126
+ adjusted_position.X += sr.Left
112
127
  # Resume normal processing
113
- handle = handles[stream_id]
128
+ handle = _GetStdHandle(stream_id)
114
129
  return _SetConsoleCursorPosition(handle, adjusted_position)
115
130
 
116
131
  def FillConsoleOutputCharacter(stream_id, char, length, start):
117
- handle = handles[stream_id]
118
- char = c_char(char)
132
+ handle = _GetStdHandle(stream_id)
133
+ char = c_char(char.encode())
119
134
  length = wintypes.DWORD(length)
120
135
  num_written = wintypes.DWORD(0)
121
136
  # Note that this is hard-coded for ANSI (vs wide) bytes.
@@ -125,10 +140,13 @@ else:
125
140
 
126
141
  def FillConsoleOutputAttribute(stream_id, attr, length, start):
127
142
  ''' FillConsoleOutputAttribute( hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten )'''
128
- handle = handles[stream_id]
143
+ handle = _GetStdHandle(stream_id)
129
144
  attribute = wintypes.WORD(attr)
130
145
  length = wintypes.DWORD(length)
131
146
  num_written = wintypes.DWORD(0)
132
147
  # Note that this is hard-coded for ANSI (vs wide) bytes.
133
148
  return _FillConsoleOutputAttribute(
134
149
  handle, attribute, length, start, byref(num_written))
150
+
151
+ def SetConsoleTitle(title):
152
+ return _SetConsoleTitleW(title)
@@ -15,9 +15,9 @@ class WinColor(object):
15
15
 
16
16
  # from wincon.h
17
17
  class WinStyle(object):
18
- NORMAL = 0x00 # dim text, dim background
19
- BRIGHT = 0x08 # bright text, dim background
20
-
18
+ NORMAL = 0x00 # dim text, dim background
19
+ BRIGHT = 0x08 # bright text, dim background
20
+ BRIGHT_BACKGROUND = 0x80 # dim text, bright background
21
21
 
22
22
  class WinTerm(object):
23
23
 
@@ -27,29 +27,45 @@ class WinTerm(object):
27
27
  self._default_fore = self._fore
28
28
  self._default_back = self._back
29
29
  self._default_style = self._style
30
+ # In order to emulate LIGHT_EX in windows, we borrow the BRIGHT style.
31
+ # So that LIGHT_EX colors and BRIGHT style do not clobber each other,
32
+ # we track them separately, since LIGHT_EX is overwritten by Fore/Back
33
+ # and BRIGHT is overwritten by Style codes.
34
+ self._light = 0
30
35
 
31
36
  def get_attrs(self):
32
- return self._fore + self._back * 16 + self._style
37
+ return self._fore + self._back * 16 + (self._style | self._light)
33
38
 
34
39
  def set_attrs(self, value):
35
40
  self._fore = value & 7
36
41
  self._back = (value >> 4) & 7
37
- self._style = value & WinStyle.BRIGHT
42
+ self._style = value & (WinStyle.BRIGHT | WinStyle.BRIGHT_BACKGROUND)
38
43
 
39
44
  def reset_all(self, on_stderr=None):
40
45
  self.set_attrs(self._default)
41
46
  self.set_console(attrs=self._default)
47
+ self._light = 0
42
48
 
43
- def fore(self, fore=None, on_stderr=False):
49
+ def fore(self, fore=None, light=False, on_stderr=False):
44
50
  if fore is None:
45
51
  fore = self._default_fore
46
52
  self._fore = fore
53
+ # Emulate LIGHT_EX with BRIGHT Style
54
+ if light:
55
+ self._light |= WinStyle.BRIGHT
56
+ else:
57
+ self._light &= ~WinStyle.BRIGHT
47
58
  self.set_console(on_stderr=on_stderr)
48
59
 
49
- def back(self, back=None, on_stderr=False):
60
+ def back(self, back=None, light=False, on_stderr=False):
50
61
  if back is None:
51
62
  back = self._default_back
52
63
  self._back = back
64
+ # Emulate LIGHT_EX with BRIGHT_BACKGROUND Style
65
+ if light:
66
+ self._light |= WinStyle.BRIGHT_BACKGROUND
67
+ else:
68
+ self._light &= ~WinStyle.BRIGHT_BACKGROUND
53
69
  self.set_console(on_stderr=on_stderr)
54
70
 
55
71
  def style(self, style=None, on_stderr=False):
@@ -73,48 +89,81 @@ class WinTerm(object):
73
89
  position.X += 1
74
90
  position.Y += 1
75
91
  return position
76
-
92
+
77
93
  def set_cursor_position(self, position=None, on_stderr=False):
78
94
  if position is None:
79
- #I'm not currently tracking the position, so there is no default.
80
- #position = self.get_position()
95
+ # I'm not currently tracking the position, so there is no default.
96
+ # position = self.get_position()
81
97
  return
82
98
  handle = win32.STDOUT
83
99
  if on_stderr:
84
100
  handle = win32.STDERR
85
101
  win32.SetConsoleCursorPosition(handle, position)
86
102
 
87
- def cursor_up(self, num_rows=0, on_stderr=False):
88
- if num_rows == 0:
89
- return
103
+ def cursor_adjust(self, x, y, on_stderr=False):
90
104
  handle = win32.STDOUT
91
105
  if on_stderr:
92
106
  handle = win32.STDERR
93
107
  position = self.get_position(handle)
94
- adjusted_position = (position.Y - num_rows, position.X)
95
- self.set_cursor_position(adjusted_position, on_stderr)
108
+ adjusted_position = (position.Y + y, position.X + x)
109
+ win32.SetConsoleCursorPosition(handle, adjusted_position, adjust=False)
96
110
 
97
- def erase_data(self, mode=0, on_stderr=False):
98
- # 0 (or None) should clear from the cursor to the end of the screen.
111
+ def erase_screen(self, mode=0, on_stderr=False):
112
+ # 0 should clear from the cursor to the end of the screen.
99
113
  # 1 should clear from the cursor to the beginning of the screen.
100
- # 2 should clear the entire screen. (And maybe move cursor to (1,1)?)
101
- #
102
- # At the moment, I only support mode 2. From looking at the API, it
103
- # should be possible to calculate a different number of bytes to clear,
104
- # and to do so relative to the cursor position.
105
- if mode[0] not in (2,):
106
- return
114
+ # 2 should clear the entire screen, and move cursor to (1,1)
107
115
  handle = win32.STDOUT
108
116
  if on_stderr:
109
117
  handle = win32.STDERR
110
- # here's where we'll home the cursor
111
- coord_screen = win32.COORD(0,0)
112
118
  csbi = win32.GetConsoleScreenBufferInfo(handle)
113
119
  # get the number of character cells in the current buffer
114
- dw_con_size = csbi.dwSize.X * csbi.dwSize.Y
120
+ cells_in_screen = csbi.dwSize.X * csbi.dwSize.Y
121
+ # get number of character cells before current cursor position
122
+ cells_before_cursor = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X
123
+ if mode == 0:
124
+ from_coord = csbi.dwCursorPosition
125
+ cells_to_erase = cells_in_screen - cells_before_cursor
126
+ elif mode == 1:
127
+ from_coord = win32.COORD(0, 0)
128
+ cells_to_erase = cells_before_cursor
129
+ elif mode == 2:
130
+ from_coord = win32.COORD(0, 0)
131
+ cells_to_erase = cells_in_screen
132
+ else:
133
+ # invalid mode
134
+ return
115
135
  # fill the entire screen with blanks
116
- win32.FillConsoleOutputCharacter(handle, ' ', dw_con_size, coord_screen)
136
+ win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
117
137
  # now set the buffer's attributes accordingly
118
- win32.FillConsoleOutputAttribute(handle, self.get_attrs(), dw_con_size, coord_screen );
119
- # put the cursor at (0, 0)
120
- win32.SetConsoleCursorPosition(handle, (coord_screen.X, coord_screen.Y))
138
+ win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
139
+ if mode == 2:
140
+ # put the cursor where needed
141
+ win32.SetConsoleCursorPosition(handle, (1, 1))
142
+
143
+ def erase_line(self, mode=0, on_stderr=False):
144
+ # 0 should clear from the cursor to the end of the line.
145
+ # 1 should clear from the cursor to the beginning of the line.
146
+ # 2 should clear the entire line.
147
+ handle = win32.STDOUT
148
+ if on_stderr:
149
+ handle = win32.STDERR
150
+ csbi = win32.GetConsoleScreenBufferInfo(handle)
151
+ if mode == 0:
152
+ from_coord = csbi.dwCursorPosition
153
+ cells_to_erase = csbi.dwSize.X - csbi.dwCursorPosition.X
154
+ elif mode == 1:
155
+ from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
156
+ cells_to_erase = csbi.dwCursorPosition.X
157
+ elif mode == 2:
158
+ from_coord = win32.COORD(0, csbi.dwCursorPosition.Y)
159
+ cells_to_erase = csbi.dwSize.X
160
+ else:
161
+ # invalid mode
162
+ return
163
+ # fill the entire screen with blanks
164
+ win32.FillConsoleOutputCharacter(handle, ' ', cells_to_erase, from_coord)
165
+ # now set the buffer's attributes accordingly
166
+ win32.FillConsoleOutputAttribute(handle, self.get_attrs(), cells_to_erase, from_coord)
167
+
168
+ def set_title(self, title):
169
+ win32.SetConsoleTitle(title)
@@ -2553,7 +2553,7 @@ def main():
2553
2553
  os.environ['LC_ALL'] = 'C'
2554
2554
  RealMain(sys.argv)
2555
2555
  except KeyboardInterrupt:
2556
- print
2556
+ print()
2557
2557
  StatusUpdate("Interrupted.")
2558
2558
  sys.exit(1)
2559
2559
  except auth.AuthenticationError as e:
@@ -5,6 +5,8 @@
5
5
 
6
6
  """Uploads files to Google Storage content addressed."""
7
7
 
8
+ from __future__ import print_function
9
+
8
10
  import hashlib
9
11
  import optparse
10
12
  import os
@@ -170,7 +172,7 @@ def upload_to_google_storage(
170
172
  with open(filename + '.sha1', 'rb') as f:
171
173
  sha1_file = f.read(1024)
172
174
  if not re.match('^([a-z0-9]{40})$', sha1_file):
173
- print >> sys.stderr, 'Invalid sha1 hash file %s.sha1' % filename
175
+ print('Invalid sha1 hash file %s.sha1' % filename, file=sys.stderr)
174
176
  return 1
175
177
  upload_queue.put((filename, sha1_file))
176
178
  continue
@@ -191,19 +193,19 @@ def upload_to_google_storage(
191
193
  printer_thread.join()
192
194
 
193
195
  # Print timing information.
194
- print 'Hashing %s files took %1f seconds' % (
195
- len(input_filenames), hashing_duration)
196
- print 'Uploading took %1f seconds' % (time.time() - upload_timer)
196
+ print('Hashing %s files took %1f seconds' % (
197
+ len(input_filenames), hashing_duration))
198
+ print('Uploading took %1f seconds' % (time.time() - upload_timer))
197
199
 
198
200
  # See if we ran into any errors.
199
201
  max_ret_code = 0
200
202
  for ret_code, message in ret_codes.queue:
201
203
  max_ret_code = max(ret_code, max_ret_code)
202
204
  if message:
203
- print >> sys.stderr, message
205
+ print(message, file=sys.stderr)
204
206
 
205
207
  if not max_ret_code:
206
- print 'Success!'
208
+ print('Success!')
207
209
 
208
210
  return max_ret_code
209
211
 
@@ -1,4 +1,4 @@
1
- #!/bin/bash
1
+ #!/usr/bin/env bash
2
2
 
3
3
  # Copyright 2018 The Chromium Authors. All rights reserved.
4
4
  # Use of this source code is governed by a BSD-style license that can be
@@ -17,6 +17,8 @@ the watchers for files given on the command line. This is useful to verify
17
17
  changes to WATCHLISTS files.
18
18
  """
19
19
 
20
+ from __future__ import print_function
21
+
20
22
  import logging
21
23
  import os
22
24
  import re
@@ -126,12 +128,12 @@ class Watchlists(object):
126
128
  def main(argv):
127
129
  # Confirm that watchlists can be parsed and spew out the watchers
128
130
  if len(argv) < 2:
129
- print "Usage (from the base of repo):"
130
- print " %s [file-1] [file-2] ...." % argv[0]
131
+ print("Usage (from the base of repo):")
132
+ print(" %s [file-1] [file-2] ...." % argv[0])
131
133
  return 1
132
134
  wl = Watchlists(os.getcwd())
133
135
  watchers = wl.GetWatchersForPaths(argv[1:])
134
- print watchers
136
+ print(watchers)
135
137
 
136
138
 
137
139
  if __name__ == '__main__':
@@ -6,6 +6,8 @@
6
6
  """Display log of checkins of one particular developer since a particular
7
7
  date. Only works on git dependencies at the moment."""
8
8
 
9
+ from __future__ import print_function
10
+
9
11
  import gclient_utils
10
12
  import optparse
11
13
  import os
@@ -25,8 +27,8 @@ def show_log(path, authors, since='1 week ago'):
25
27
  stdout=subprocess.PIPE).communicate()[0].rstrip()
26
28
 
27
29
  if len(status.splitlines()) > 0:
28
- print '---------- %s ----------' % path
29
- print status
30
+ print('---------- %s ----------' % path)
31
+ print(status)
30
32
 
31
33
 
32
34
  def main():
@@ -26,6 +26,8 @@ future when a hypothetical VS2015 is released, the 2013 script will be
26
26
  maintained, and a new 2015 script would be added.
27
27
  """
28
28
 
29
+ from __future__ import print_function
30
+
29
31
  import hashlib
30
32
  import json
31
33
  import optparse
@@ -52,12 +54,12 @@ elif sys.platform == "cygwin":
52
54
  try:
53
55
  import cygwinreg as winreg
54
56
  except ImportError:
55
- print ''
56
- print 'CygWin does not natively support winreg but a replacement exists.'
57
- print 'https://pypi.python.org/pypi/cygwinreg/'
58
- print ''
59
- print 'Try: easy_install cygwinreg'
60
- print ''
57
+ print('')
58
+ print('CygWin does not natively support winreg but a replacement exists.')
59
+ print('https://pypi.python.org/pypi/cygwinreg/')
60
+ print('')
61
+ print('Try: easy_install cygwinreg')
62
+ print('')
61
63
  raise
62
64
 
63
65
  BASEDIR = os.path.dirname(os.path.abspath(__file__))
@@ -144,25 +146,25 @@ def CalculateHash(root, expected_hash):
144
146
  timestamps_data_files.append(f[0])
145
147
  missing_files = [f for f in timestamps_data_files if f not in file_list]
146
148
  if len(missing_files):
147
- print ('%d files missing from the %s version of the toolchain:' %
149
+ print('%d files missing from the %s version of the toolchain:' %
148
150
  (len(missing_files), expected_hash))
149
151
  for f in missing_files[:10]:
150
- print '\t%s' % f
152
+ print('\t%s' % f)
151
153
  if len(missing_files) > 10:
152
- print '\t...'
154
+ print('\t...')
153
155
  extra_files = [f for f in file_list if f not in timestamps_data_files]
154
156
  if len(extra_files):
155
- print ('%d extra files in the %s version of the toolchain:' %
157
+ print('%d extra files in the %s version of the toolchain:' %
156
158
  (len(extra_files), expected_hash))
157
159
  for f in extra_files[:10]:
158
- print '\t%s' % f
160
+ print('\t%s' % f)
159
161
  if len(extra_files) > 10:
160
- print '\t...'
162
+ print('\t...')
161
163
  if matches:
162
164
  return timestamps_data['sha1']
163
165
 
164
166
  # Make long hangs when updating the toolchain less mysterious.
165
- print 'Calculating hash of toolchain in %s. Please wait...' % full_root_path
167
+ print('Calculating hash of toolchain in %s. Please wait...' % full_root_path)
166
168
  sys.stdout.flush()
167
169
  digest = hashlib.sha1()
168
170
  for path in file_list:
@@ -189,7 +191,7 @@ def CalculateToolchainHashes(root, remove_corrupt_toolchains):
189
191
  for d in dir_list:
190
192
  toolchain_hash = CalculateHash(root, d)
191
193
  if toolchain_hash != d:
192
- print ('The hash of a version of the toolchain has an unexpected value ('
194
+ print('The hash of a version of the toolchain has an unexpected value ('
193
195
  '%s instead of %s)%s.' % (toolchain_hash, d,
194
196
  ', removing it' if remove_corrupt_toolchains else ''))
195
197
  if remove_corrupt_toolchains:
@@ -259,23 +261,23 @@ def RequestGsAuthentication():
259
261
  Googler. This allows much faster downloads, and pulling (old) toolchains
260
262
  that match src/ revisions.
261
263
  """
262
- print 'Access to gs://chrome-wintoolchain/ not configured.'
263
- print '-----------------------------------------------------------------'
264
- print
265
- print 'You appear to be a Googler.'
266
- print
267
- print 'I\'m sorry for the hassle, but you need to do a one-time manual'
268
- print 'authentication. Please run:'
269
- print
270
- print ' download_from_google_storage --config'
271
- print
272
- print 'and follow the instructions.'
273
- print
274
- print 'NOTE 1: Use your google.com credentials, not chromium.org.'
275
- print 'NOTE 2: Enter 0 when asked for a "project-id".'
276
- print
277
- print '-----------------------------------------------------------------'
278
- print
264
+ print('Access to gs://chrome-wintoolchain/ not configured.')
265
+ print('-----------------------------------------------------------------')
266
+ print()
267
+ print('You appear to be a Googler.')
268
+ print()
269
+ print('I\'m sorry for the hassle, but you need to do a one-time manual')
270
+ print('authentication. Please run:')
271
+ print()
272
+ print(' download_from_google_storage --config')
273
+ print()
274
+ print('and follow the instructions.')
275
+ print()
276
+ print('NOTE 1: Use your google.com credentials, not chromium.org.')
277
+ print('NOTE 2: Enter 0 when asked for a "project-id".')
278
+ print()
279
+ print('-----------------------------------------------------------------')
280
+ print()
279
281
  sys.stdout.flush()
280
282
  sys.exit(1)
281
283
 
@@ -289,7 +291,7 @@ def DelayBeforeRemoving(target_dir):
289
291
  '\rRemoving old toolchain in %ds... (Ctrl-C to cancel)' % i)
290
292
  sys.stdout.flush()
291
293
  time.sleep(1)
292
- print
294
+ print()
293
295
 
294
296
 
295
297
  def DownloadUsingHttp(filename):
@@ -396,7 +398,7 @@ def RemoveUnusedToolchains(root):
396
398
  os.remove(full_path)
397
399
 
398
400
  for d in dirs_to_remove:
399
- print ('Removing %s as it doesn\'t correspond to any known toolchain.' %
401
+ print('Removing %s as it doesn\'t correspond to any known toolchain.' %
400
402
  os.path.join(root, d))
401
403
  # Use the RemoveToolchain function to remove these directories as they might
402
404
  # contain an older version of the toolchain.
@@ -408,7 +410,7 @@ def RemoveUnusedToolchains(root):
408
410
  for toolchain in valid_toolchains:
409
411
  toolchain_age_in_sec = time.time() - toolchain[0]
410
412
  if toolchain_age_in_sec > toolchain_expiration_time:
411
- print ('Removing version %s of the Win toolchain as it hasn\'t been used'
413
+ print('Removing version %s of the Win toolchain as it hasn\'t been used'
412
414
  ' in the past %d days.' % (toolchain[1],
413
415
  toolchain_age_in_sec / 60 / 60 / 24))
414
416
  RemoveToolchain(root, toolchain[1], True)
@@ -569,10 +571,10 @@ def main():
569
571
  if got_new_toolchain:
570
572
  current_hashes = CalculateToolchainHashes(target_dir, False)
571
573
  if desired_hash not in current_hashes:
572
- print >> sys.stderr, (
574
+ print(
573
575
  'Got wrong hash after pulling a new toolchain. '
574
576
  'Wanted \'%s\', got one of \'%s\'.' % (
575
- desired_hash, ', '.join(current_hashes)))
577
+ desired_hash, ', '.join(current_hashes)), file=sys.stderr)
576
578
  return 1
577
579
  SaveTimestampsAndHash(target_dir, desired_hash)
578
580