libv8 5.1.281.59.1 → 5.2.361.43.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +0 -7
  3. data/CHANGELOG.md +9 -1
  4. data/README.md +41 -23
  5. data/Rakefile +1 -1
  6. data/ext/libv8/builder.rb +1 -1
  7. data/ext/libv8/compiler/apple_llvm.rb +5 -4
  8. data/ext/libv8/compiler/clang.rb +5 -4
  9. data/ext/libv8/compiler/gcc.rb +5 -4
  10. data/ext/libv8/compiler/generic_compiler.rb +11 -1
  11. data/lib/libv8/version.rb +1 -1
  12. data/patches/0001-Build-a-standalone-static-library.patch +26 -0
  13. data/patches/{0002-Disable-building-tests.patch → 0002-Don-t-compile-unnecessary-stuff.patch} +31 -34
  14. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +10 -10
  15. data/patches/0004-Reinterpret-thread-hash-for-FreeBSD-too.patch +25 -0
  16. data/release/armhf-linux/Vagrantfile +95 -0
  17. data/release/armhf-linux/initrd.img +0 -0
  18. data/release/armhf-linux/vmlinuz +0 -0
  19. data/release/{x86_64-freebsd10 → x86_64-freebsd-10}/Vagrantfile +3 -1
  20. data/spec/compiler/apple_llvm_spec.rb +10 -3
  21. data/spec/compiler/clang_spec.rb +7 -0
  22. data/spec/compiler_spec.rb +1 -1
  23. data/spec/support/compiler_helpers.rb +3 -1
  24. data/vendor/depot_tools/{README → README.md} +33 -12
  25. data/vendor/depot_tools/checkout.py +7 -2
  26. data/vendor/depot_tools/cit.py +51 -13
  27. data/vendor/depot_tools/cpplint.py +27 -5
  28. data/vendor/depot_tools/git_cl.py +370 -290
  29. data/vendor/depot_tools/git_common.py +133 -28
  30. data/vendor/depot_tools/git_drover.py +29 -2
  31. data/vendor/depot_tools/git_map.py +2 -2
  32. data/vendor/depot_tools/git_map_branches.py +9 -5
  33. data/vendor/depot_tools/git_rebase_update.py +3 -3
  34. data/vendor/depot_tools/git_upstream_diff.py +1 -1
  35. data/vendor/depot_tools/infra/config/OWNERS +1 -0
  36. data/vendor/depot_tools/infra/config/cq.cfg +8 -3
  37. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  38. data/vendor/depot_tools/man/html/depot_tools.html +10 -2
  39. data/vendor/depot_tools/man/html/depot_tools_tutorial.html +14 -15
  40. data/vendor/depot_tools/man/html/git-auto-svn.html +2 -2
  41. data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +2 -11
  42. data/vendor/depot_tools/man/html/git-drover.html +19 -17
  43. data/vendor/depot_tools/man/html/git-footers.html +2 -2
  44. data/vendor/depot_tools/man/html/git-freeze.html +17 -4
  45. data/vendor/depot_tools/man/html/git-hyper-blame.html +2 -2
  46. data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
  47. data/vendor/depot_tools/man/html/git-map.html +3 -3
  48. data/vendor/depot_tools/man/html/git-mark-merge-base.html +2 -2
  49. data/vendor/depot_tools/man/html/git-nav-downstream.html +7 -7
  50. data/vendor/depot_tools/man/html/git-nav-upstream.html +4 -4
  51. data/vendor/depot_tools/man/html/git-new-branch.html +2 -2
  52. data/vendor/depot_tools/man/html/git-rebase-update.html +2 -2
  53. data/vendor/depot_tools/man/html/git-rename-branch.html +2 -2
  54. data/vendor/depot_tools/man/html/git-reparent-branch.html +2 -2
  55. data/vendor/depot_tools/man/html/git-retry.html +2 -2
  56. data/vendor/depot_tools/man/html/git-squash-branch.html +4 -4
  57. data/vendor/depot_tools/man/html/git-thaw.html +2 -2
  58. data/vendor/depot_tools/man/html/git-upstream-diff.html +2 -2
  59. data/vendor/depot_tools/man/man1/git-auto-svn.1 +4 -4
  60. data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +5 -14
  61. data/vendor/depot_tools/man/man1/git-drover.1 +21 -19
  62. data/vendor/depot_tools/man/man1/git-footers.1 +5 -5
  63. data/vendor/depot_tools/man/man1/git-freeze.1 +12 -6
  64. data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
  65. data/vendor/depot_tools/man/man1/git-map-branches.1 +5 -7
  66. data/vendor/depot_tools/man/man1/git-map.1 +5 -5
  67. data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
  68. data/vendor/depot_tools/man/man1/git-nav-downstream.1 +9 -9
  69. data/vendor/depot_tools/man/man1/git-nav-upstream.1 +6 -6
  70. data/vendor/depot_tools/man/man1/git-new-branch.1 +4 -4
  71. data/vendor/depot_tools/man/man1/git-rebase-update.1 +4 -4
  72. data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
  73. data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
  74. data/vendor/depot_tools/man/man1/git-retry.1 +4 -4
  75. data/vendor/depot_tools/man/man1/git-squash-branch.1 +6 -6
  76. data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
  77. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +4 -4
  78. data/vendor/depot_tools/man/man7/depot_tools.7 +9 -4
  79. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +14 -15
  80. data/vendor/depot_tools/man/src/depot_tools_tutorial.txt +1 -2
  81. data/vendor/depot_tools/man/src/git-freeze.txt +15 -0
  82. data/vendor/depot_tools/man/src/make_docs.sh +4 -4
  83. data/vendor/depot_tools/owners.py +50 -46
  84. data/vendor/depot_tools/owners_finder.py +6 -19
  85. data/vendor/depot_tools/presubmit_canned_checks.py +2 -1
  86. data/vendor/depot_tools/presubmit_support.py +8 -10
  87. data/vendor/depot_tools/recipe_modules/bot_update/api.py +69 -55
  88. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail.json +1 -0
  89. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch.json +1 -0
  90. data/vendor/depot_tools/recipe_modules/bot_update/example.expected/tryjob_fail_patch_download.json +1 -0
  91. data/vendor/depot_tools/recipe_modules/bot_update/resources/bot_update.py +2 -0
  92. data/vendor/depot_tools/recipe_modules/gclient/api.py +0 -17
  93. data/vendor/depot_tools/recipe_modules/gclient/config.py +9 -8
  94. data/vendor/depot_tools/recipe_modules/gclient/example.py +1 -1
  95. data/vendor/depot_tools/recipe_modules/git/api.py +20 -4
  96. data/vendor/depot_tools/recipe_modules/git/example.expected/can_fail_build.json +1 -0
  97. data/vendor/depot_tools/recipe_modules/git/example.expected/count-objects_with_bad_output_fails_build.json +1 -0
  98. data/vendor/depot_tools/recipe_modules/git/example.expected/git-cache-checkout.json +189 -0
  99. data/vendor/depot_tools/recipe_modules/git/example.expected/platform_win.json +2 -1
  100. data/vendor/depot_tools/recipe_modules/git/example.expected/rebase_failed.json +1 -0
  101. data/vendor/depot_tools/recipe_modules/git/example.py +6 -1
  102. data/vendor/depot_tools/recipe_modules/git_cl/api.py +13 -0
  103. data/vendor/depot_tools/recipe_modules/git_cl/example.expected/basic.json +17 -0
  104. data/vendor/depot_tools/recipe_modules/git_cl/example.py +3 -0
  105. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_linux.json +14 -0
  106. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_mac.json +14 -0
  107. data/vendor/depot_tools/recipe_modules/infra_paths/example.expected/paths_swarmbucket_win.json +14 -0
  108. data/vendor/depot_tools/recipe_modules/infra_paths/example.py +1 -1
  109. data/vendor/depot_tools/recipe_modules/infra_paths/path_config.py +23 -10
  110. data/vendor/depot_tools/recipe_modules/tryserver/api.py +5 -3
  111. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_git_patch.json +1 -0
  112. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch.json +1 -0
  113. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_rietveld_patch_new.json +1 -0
  114. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_svn_patch.json +1 -0
  115. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch.json +3 -1
  116. data/vendor/depot_tools/recipe_modules/tryserver/example.expected/with_wrong_patch_new.json +3 -1
  117. data/vendor/depot_tools/recipes.py +56 -27
  118. data/vendor/depot_tools/rietveld.py +10 -0
  119. data/vendor/depot_tools/third_party/httplib2/README.chromium +3 -3
  120. data/vendor/depot_tools/third_party/httplib2/__init__.py +31 -15
  121. data/vendor/depot_tools/third_party/upload.py +54 -45
  122. data/vendor/depot_tools/update_depot_tools +16 -70
  123. data/vendor/depot_tools/update_depot_tools.bat +4 -18
  124. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +10 -6
  125. metadata +15 -8
  126. data/patches/0001-Build-standalone-static-library.patch +0 -26
  127. data/vendor/depot_tools/git_utils/git-tree-prune +0 -122
@@ -4,7 +4,8 @@
4
4
  "RECIPE_PACKAGE_REPO[depot_tools]\\bootstrap\\win\\win_tools.bat"
5
5
  ],
6
6
  "cwd": "RECIPE_PACKAGE_REPO[depot_tools]",
7
- "name": "ensure git tooling on windows"
7
+ "name": "ensure git tooling on windows",
8
+ "timeout": 300
8
9
  },
9
10
  {
10
11
  "cmd": [
@@ -38,6 +39,7 @@
38
39
  {
39
40
  "name": "$result",
40
41
  "reason": "Step('fail') failed with return_code 1",
42
+ "recipe_result": null,
41
43
  "status_code": 1
42
44
  }
43
45
  ]
@@ -4,7 +4,8 @@
4
4
  "RECIPE_PACKAGE_REPO[depot_tools]\\bootstrap\\win\\win_tools.bat"
5
5
  ],
6
6
  "cwd": "RECIPE_PACKAGE_REPO[depot_tools]",
7
- "name": "ensure git tooling on windows"
7
+ "name": "ensure git tooling on windows",
8
+ "timeout": 300
8
9
  },
9
10
  {
10
11
  "cmd": [
@@ -38,6 +39,7 @@
38
39
  {
39
40
  "name": "$result",
40
41
  "reason": "Step('fail') failed with return_code 1",
42
+ "recipe_result": null,
41
43
  "status_code": 1
42
44
  }
43
45
  ]
@@ -1,14 +1,33 @@
1
1
  #!/usr/bin/env python
2
2
 
3
- # Copyright 2015 The Chromium Authors. All rights reserved.
4
- # Use of this source code is governed by a BSD-style license that can be
5
- # found in the LICENSE file.
3
+ # Copyright 2016 The LUCI Authors. All rights reserved.
4
+ # Use of this source code is governed under the Apache License, Version 2.0
5
+ # that can be found in the LICENSE file.
6
6
 
7
- """Bootstrap script to clone and forward to the recipe engine tool."""
7
+ """Bootstrap script to clone and forward to the recipe engine tool.
8
+
9
+ ***********************************************************************
10
+ ** DO NOT MODIFY EXCEPT IN THE PER-REPO CONFIGURATION SECTION BELOW. **
11
+ ***********************************************************************
12
+
13
+ This is a copy of https://github.com/luci/recipes-py/blob/master/doc/recipes.py.
14
+ To fix bugs, fix in the github repo then copy it back to here and fix the
15
+ PER-REPO CONFIGURATION section to look like this one.
16
+ """
17
+
18
+ import os
19
+
20
+ #### PER-REPO CONFIGURATION (editable) ####
21
+ # The root of the repository relative to the directory of this file.
22
+ REPO_ROOT = ''
23
+ # The path of the recipes.cfg file relative to the root of the repository.
24
+ RECIPES_CFG = os.path.join('infra', 'config', 'recipes.cfg')
25
+ #### END PER-REPO CONFIGURATION ####
26
+
27
+ BOOTSTRAP_VERSION = 1
8
28
 
9
29
  import ast
10
30
  import logging
11
- import os
12
31
  import random
13
32
  import re
14
33
  import subprocess
@@ -16,12 +35,6 @@ import sys
16
35
  import time
17
36
  import traceback
18
37
 
19
- BOOTSTRAP_VERSION = 1
20
- # The root of the repository relative to the directory of this file.
21
- REPO_ROOT = ''
22
- # The path of the recipes.cfg file relative to the root of the repository.
23
- RECIPES_CFG = os.path.join('infra', 'config', 'recipes.cfg')
24
-
25
38
 
26
39
  def parse_protobuf(fh):
27
40
  """Parse the protobuf text format just well enough to understand recipes.cfg.
@@ -39,8 +52,10 @@ def parse_protobuf(fh):
39
52
  A recursive dictionary of lists.
40
53
  """
41
54
  def parse_atom(text):
42
- if text == 'true': return True
43
- if text == 'false': return False
55
+ if text == 'true':
56
+ return True
57
+ if text == 'false':
58
+ return False
44
59
  return ast.literal_eval(text)
45
60
 
46
61
  ret = {}
@@ -57,10 +72,12 @@ def parse_protobuf(fh):
57
72
  ret.setdefault(m.group(1), []).append(subparse)
58
73
  continue
59
74
 
60
- if line == '}': return ret
61
- if line == '': continue
75
+ if line == '}':
76
+ return ret
77
+ if line == '':
78
+ continue
62
79
 
63
- raise Exception('Could not understand line: <%s>' % line)
80
+ raise ValueError('Could not understand line: <%s>' % line)
64
81
 
65
82
  return ret
66
83
 
@@ -76,7 +93,19 @@ def get_unique(things):
76
93
  return things[0]
77
94
 
78
95
 
96
+ def _subprocess_call(argv, **kwargs):
97
+ logging.info('Running %r', argv)
98
+ return subprocess.call(argv, **kwargs)
99
+
100
+ def _subprocess_check_call(argv, **kwargs):
101
+ logging.info('Running %r', argv)
102
+ subprocess.check_call(argv, **kwargs)
103
+
104
+
79
105
  def main():
106
+ if '--verbose' in sys.argv:
107
+ logging.getLogger().setLevel(logging.INFO)
108
+
80
109
  if sys.platform.startswith(('win', 'cygwin')):
81
110
  git = 'git.bat'
82
111
  else:
@@ -107,28 +136,28 @@ def main():
107
136
  if not os.path.exists(deps_path):
108
137
  os.makedirs(deps_path)
109
138
  if not os.path.exists(engine_path):
110
- subprocess.check_call([git, 'clone', engine_url, engine_path])
139
+ _subprocess_check_call([git, 'clone', engine_url, engine_path])
111
140
 
112
- needs_fetch = subprocess.call(
141
+ needs_fetch = _subprocess_call(
113
142
  [git, 'rev-parse', '--verify', '%s^{commit}' % engine_revision],
114
143
  cwd=engine_path, stdout=open(os.devnull, 'w'))
115
144
  if needs_fetch:
116
- subprocess.check_call([git, 'fetch'], cwd=engine_path)
117
- subprocess.check_call(
145
+ _subprocess_check_call([git, 'fetch'], cwd=engine_path)
146
+ _subprocess_check_call(
118
147
  [git, 'checkout', '--quiet', engine_revision], cwd=engine_path)
119
148
 
120
149
  try:
121
150
  ensure_engine()
122
- except subprocess.CalledProcessError as e:
123
- if e.returncode == 128: # Thrown when git gets a lock error.
124
- time.sleep(random.uniform(2,5))
125
- ensure_engine()
126
- else:
127
- raise
151
+ except subprocess.CalledProcessError:
152
+ logging.exception('ensure_engine failed')
153
+
154
+ # Retry errors.
155
+ time.sleep(random.uniform(2,5))
156
+ ensure_engine()
128
157
 
129
158
  args = ['--package', recipes_cfg_path,
130
159
  '--bootstrap-script', __file__] + sys.argv[1:]
131
- return subprocess.call([
160
+ return _subprocess_call([
132
161
  sys.executable, '-u',
133
162
  os.path.join(engine_path, engine_subpath, 'recipes.py')] + args)
134
163
 
@@ -278,6 +278,12 @@ class Rietveld(object):
278
278
  ('xsrf_token', self.xsrf_token()),
279
279
  (flag, str(value))])
280
280
 
281
+ def set_flags(self, issue, patchset, flags):
282
+ return self.post('/%d/edit_flags' % issue, [
283
+ ('last_patchset', str(patchset)),
284
+ ('xsrf_token', self.xsrf_token()),
285
+ ] + [(flag, str(value)) for flag, value in flags.iteritems()])
286
+
281
287
  def search(
282
288
  self,
283
289
  owner=None, reviewer=None,
@@ -744,6 +750,10 @@ class ReadOnlyRietveld(object):
744
750
  (flag, value, issue))
745
751
  ReadOnlyRietveld._local_changes.setdefault(issue, {})[flag] = value
746
752
 
753
+ def set_flags(self, issue, patchset, flags):
754
+ for flag, value in flags.iteritems():
755
+ self.set_flag(issue, patchset, flag, value)
756
+
747
757
  def trigger_try_jobs( # pylint:disable=R0201
748
758
  self, issue, patchset, reason, clobber, revision, builders_and_tests,
749
759
  master=None, category='cq'):
@@ -1,8 +1,8 @@
1
1
  Name: httplib2
2
2
  Short Name: httplib2
3
- URL: https://github.com/jcgregorio/httplib2
4
- Version: 0.8
5
- Revision: 0197ec868a4fc638c08358b94200ffd6ddb1bf50
3
+ URL: https://github.com/httplib2/httplib2
4
+ Version: 0.9.2
5
+ Revision: cf631a73e2f3f43897b65206127ced82382d35f5
6
6
  License: MIT License
7
7
 
8
8
  Description:
@@ -22,7 +22,7 @@ __contributors__ = ["Thomas Broyer (t.broyer@ltgt.net)",
22
22
  "Sam Ruby",
23
23
  "Louis Nyffenegger"]
24
24
  __license__ = "MIT"
25
- __version__ = "0.8"
25
+ __version__ = "0.9.2"
26
26
 
27
27
  import re
28
28
  import sys
@@ -749,12 +749,27 @@ class ProxyInfo(object):
749
749
  bypass_hosts = ()
750
750
 
751
751
  def __init__(self, proxy_type, proxy_host, proxy_port,
752
- proxy_rdns=None, proxy_user=None, proxy_pass=None):
753
- """The parameter proxy_type must be set to one of socks.PROXY_TYPE_XXX
754
- constants. For example:
752
+ proxy_rdns=True, proxy_user=None, proxy_pass=None):
753
+ """
754
+ Args:
755
+ proxy_type: The type of proxy server. This must be set to one of
756
+ socks.PROXY_TYPE_XXX constants. For example:
757
+
758
+ p = ProxyInfo(proxy_type=socks.PROXY_TYPE_HTTP,
759
+ proxy_host='localhost', proxy_port=8000)
760
+
761
+ proxy_host: The hostname or IP address of the proxy server.
762
+
763
+ proxy_port: The port that the proxy server is running on.
755
764
 
756
- p = ProxyInfo(proxy_type=socks.PROXY_TYPE_HTTP,
757
- proxy_host='localhost', proxy_port=8000)
765
+ proxy_rdns: If True (default), DNS queries will not be performed
766
+ locally, and instead, handed to the proxy to resolve. This is useful
767
+ if the network does not allow resolution of non-local names. In
768
+ httplib2 0.9 and earlier, this defaulted to False.
769
+
770
+ proxy_user: The username used to authenticate with the proxy server.
771
+
772
+ proxy_pass: The password used to authenticate with the proxy server.
758
773
  """
759
774
  self.proxy_type = proxy_type
760
775
  self.proxy_host = proxy_host
@@ -871,12 +886,12 @@ class HTTPConnectionWithTimeout(httplib.HTTPConnection):
871
886
  if self.proxy_info and self.proxy_info.isgood():
872
887
  use_proxy = True
873
888
  proxy_type, proxy_host, proxy_port, proxy_rdns, proxy_user, proxy_pass = self.proxy_info.astuple()
874
- else:
875
- use_proxy = False
876
- if use_proxy and proxy_rdns:
889
+
877
890
  host = proxy_host
878
891
  port = proxy_port
879
892
  else:
893
+ use_proxy = False
894
+
880
895
  host = self.host
881
896
  port = self.port
882
897
 
@@ -993,12 +1008,12 @@ class HTTPSConnectionWithTimeout(httplib.HTTPSConnection):
993
1008
  if self.proxy_info and self.proxy_info.isgood():
994
1009
  use_proxy = True
995
1010
  proxy_type, proxy_host, proxy_port, proxy_rdns, proxy_user, proxy_pass = self.proxy_info.astuple()
996
- else:
997
- use_proxy = False
998
- if use_proxy and proxy_rdns:
1011
+
999
1012
  host = proxy_host
1000
1013
  port = proxy_port
1001
1014
  else:
1015
+ use_proxy = False
1016
+
1002
1017
  host = self.host
1003
1018
  port = self.port
1004
1019
 
@@ -1270,8 +1285,9 @@ class Http(object):
1270
1285
  err = getattr(e, 'args')[0]
1271
1286
  else:
1272
1287
  err = e.errno
1273
- if err == errno.ECONNREFUSED: # Connection refused
1274
- raise
1288
+ if err in (errno.ENETUNREACH, errno.EADDRNOTAVAIL) and i < RETRIES:
1289
+ continue # retry on potentially transient socket errors
1290
+ raise
1275
1291
  except httplib.HTTPException:
1276
1292
  # Just because the server closed the connection doesn't apparently mean
1277
1293
  # that the server didn't send a response.
@@ -1481,7 +1497,7 @@ class Http(object):
1481
1497
  info = email.Message.Message()
1482
1498
  cached_value = None
1483
1499
  if self.cache:
1484
- cachekey = defrag_uri
1500
+ cachekey = defrag_uri.encode('utf-8')
1485
1501
  cached_value = self.cache.get(cachekey)
1486
1502
  if cached_value:
1487
1503
  # info = email.message_from_string(cached_value)
@@ -34,7 +34,8 @@ against by using the '--rev' option.
34
34
  # This code is derived from appcfg.py in the App Engine SDK (open source),
35
35
  # and from ASPN recipe #146306.
36
36
 
37
- import ConfigParser
37
+ from __future__ import print_function
38
+
38
39
  import cookielib
39
40
  import errno
40
41
  import fnmatch
@@ -54,6 +55,12 @@ import urlparse
54
55
 
55
56
  from multiprocessing.pool import ThreadPool
56
57
 
58
+ # The configparser module was renamed in Python 3.
59
+ try:
60
+ import configparser
61
+ except ImportError:
62
+ import ConfigParser as configparser
63
+
57
64
  # The md5 module was deprecated in Python 2.5.
58
65
  try:
59
66
  from hashlib import md5
@@ -144,7 +151,7 @@ def GetEmail(prompt):
144
151
  last_email = last_email_file.readline().strip("\n")
145
152
  last_email_file.close()
146
153
  prompt += " [%s]" % last_email
147
- except IOError, e:
154
+ except IOError as e:
148
155
  pass
149
156
  email = raw_input(prompt + ": ").strip()
150
157
  if email:
@@ -152,7 +159,7 @@ def GetEmail(prompt):
152
159
  last_email_file = open(last_email_file_name, "w")
153
160
  last_email_file.write(email)
154
161
  last_email_file.close()
155
- except IOError, e:
162
+ except IOError as e:
156
163
  pass
157
164
  else:
158
165
  email = last_email
@@ -168,12 +175,12 @@ def StatusUpdate(msg):
168
175
  msg: The string to print.
169
176
  """
170
177
  if verbosity > 0:
171
- print msg
178
+ print(msg)
172
179
 
173
180
 
174
181
  def ErrorExit(msg):
175
182
  """Print an error message to stderr and exit."""
176
- print >> sys.stderr, msg
183
+ print(msg, file=sys.stderr)
177
184
  sys.exit(1)
178
185
 
179
186
 
@@ -286,7 +293,7 @@ class AbstractRpcServer(object):
286
293
  response_dict = dict(x.split("=")
287
294
  for x in response_body.split("\n") if x)
288
295
  return response_dict["Auth"]
289
- except urllib2.HTTPError, e:
296
+ except urllib2.HTTPError as e:
290
297
  if e.code == 403:
291
298
  body = e.read()
292
299
  response_dict = dict(x.split("=", 1) for x in body.split("\n") if x)
@@ -311,7 +318,7 @@ class AbstractRpcServer(object):
311
318
  (self.host, urllib.urlencode(args)))
312
319
  try:
313
320
  response = self.opener.open(req)
314
- except urllib2.HTTPError, e:
321
+ except urllib2.HTTPError as e:
315
322
  response = e
316
323
  if (response.code != 302 or
317
324
  response.info()["location"] != continue_location):
@@ -355,10 +362,10 @@ class AbstractRpcServer(object):
355
362
  }
356
363
  auth_token = self._GetAuthToken(credentials[0], credentials[1],
357
364
  internal=True)
358
- except ClientLoginError, exc:
365
+ except ClientLoginError as exc:
359
366
  e = exc
360
367
  if e:
361
- print >> sys.stderr, ''
368
+ print('', file=sys.stderr)
362
369
  error_message = e.reason
363
370
  if error_map:
364
371
  error_message = error_map.get(error_message, error_message)
@@ -370,7 +377,7 @@ class AbstractRpcServer(object):
370
377
  "See http://www.google.com/"
371
378
  "support/accounts/bin/answer.py?answer=185833")
372
379
  else:
373
- print >> sys.stderr, "Invalid username or password."
380
+ print("Invalid username or password.", file=sys.stderr)
374
381
  elif error_message == "CaptchaRequired":
375
382
  print >> sys.stderr, (
376
383
  "Please go to\n"
@@ -379,23 +386,24 @@ class AbstractRpcServer(object):
379
386
  "If you are using a Google Apps account the URL is:\n"
380
387
  "https://www.google.com/a/yourdomain.com/UnlockCaptcha")
381
388
  elif error_message == "NotVerified":
382
- print >> sys.stderr, "Account not verified."
389
+ print("Account not verified.", file=sys.stderr)
383
390
  elif error_message == "TermsNotAgreed":
384
- print >> sys.stderr, "User has not agreed to TOS."
391
+ print("User has not agreed to TOS.", file=sys.stderr)
385
392
  elif error_message == "AccountDeleted":
386
- print >> sys.stderr, "The user account has been deleted."
393
+ print("The user account has been deleted.", file=sys.stderr)
387
394
  elif error_message == "AccountDisabled":
388
- print >> sys.stderr, "The user account has been disabled."
395
+ print("The user account has been disabled.", file=sys.stderr)
389
396
  break
390
397
  elif error_message == "ServiceDisabled":
391
- print >> sys.stderr, ("The user's access to the service has been "
392
- "disabled.")
398
+ print("The user's access to the service has been disabled.",
399
+ file=sys.stderr)
393
400
  elif error_message == "ServiceUnavailable":
394
- print >> sys.stderr, "The service is not available; try again later."
401
+ print("The service is not available; try again later.",
402
+ file=sys.stderr)
395
403
  else:
396
404
  # Unknown error.
397
405
  raise e
398
- print >> sys.stderr, ''
406
+ print('', file=sys.stderr)
399
407
  continue
400
408
  self._GetAuthCookie(auth_token)
401
409
  return
@@ -447,7 +455,7 @@ class AbstractRpcServer(object):
447
455
  response = f.read()
448
456
  f.close()
449
457
  return response
450
- except urllib2.HTTPError, e:
458
+ except urllib2.HTTPError as e:
451
459
  if tries > 3:
452
460
  raise
453
461
  elif e.code in (302, 401, 403):
@@ -525,10 +533,10 @@ class HttpRpcServer(AbstractRpcServer):
525
533
  pass
526
534
  else:
527
535
  # Create an empty cookie file with mode 600
528
- fd = os.open(self.cookie_file, os.O_CREAT, 0600)
536
+ fd = os.open(self.cookie_file, os.O_CREAT, 0o600)
529
537
  os.close(fd)
530
538
  # Always chmod the cookie file
531
- os.chmod(self.cookie_file, 0600)
539
+ os.chmod(self.cookie_file, 0o600)
532
540
  else:
533
541
  # Don't save cookies across runs of update.py.
534
542
  self.cookie_jar = cookielib.CookieJar()
@@ -720,10 +728,10 @@ class KeyringCreds(object):
720
728
  except:
721
729
  # Sadly, we have to trap all errors here as
722
730
  # gnomekeyring.IOError inherits from object. :/
723
- print "Failed to get password from keyring"
731
+ print("Failed to get password from keyring")
724
732
  keyring = None
725
733
  if password is not None:
726
- print "Using password from system keyring."
734
+ print("Using password from system keyring.")
727
735
  self.accounts_seen.add(email)
728
736
  else:
729
737
  password = getpass.getpass("Password for %s: " % email)
@@ -920,9 +928,9 @@ class VersionControlSystem(object):
920
928
  """Show an "are you sure?" prompt if there are unknown files."""
921
929
  unknown_files = self.GetUnknownFiles()
922
930
  if unknown_files:
923
- print "The following files are not added to version control:"
931
+ print("The following files are not added to version control:")
924
932
  for line in unknown_files:
925
- print line
933
+ print(line)
926
934
  prompt = "Are you sure to continue?(y/N) "
927
935
  answer = raw_input(prompt).strip()
928
936
  if answer != "y":
@@ -996,7 +1004,7 @@ class VersionControlSystem(object):
996
1004
  [("data", filename, content)])
997
1005
  try:
998
1006
  response_body = rpc_server.Send(url, body, content_type=ctype)
999
- except urllib2.HTTPError, e:
1007
+ except urllib2.HTTPError as e:
1000
1008
  response_body = ("Failed to upload file for %s. Got %d status code." %
1001
1009
  (filename, e.code))
1002
1010
 
@@ -1029,7 +1037,7 @@ class VersionControlSystem(object):
1029
1037
  threads.append(t)
1030
1038
 
1031
1039
  for t in threads:
1032
- print t.get(timeout=60)
1040
+ print(t.get(timeout=60))
1033
1041
 
1034
1042
  def IsImage(self, filename):
1035
1043
  """Returns true if the filename has an image extension."""
@@ -1703,7 +1711,7 @@ class PerforceVCS(VersionControlSystem):
1703
1711
  ErrorExit("Error checking perforce login")
1704
1712
  if not retcode and (not "code" in data or data["code"] != "error"):
1705
1713
  break
1706
- print "Enter perforce password: "
1714
+ print("Enter perforce password: ")
1707
1715
  self.RunPerforceCommandWithReturnCode(["login"])
1708
1716
 
1709
1717
  super(PerforceVCS, self).__init__(options)
@@ -2066,7 +2074,7 @@ def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
2066
2074
 
2067
2075
  try:
2068
2076
  response_body = rpc_server.Send(url, body, content_type=ctype)
2069
- except urllib2.HTTPError, e:
2077
+ except urllib2.HTTPError as e:
2070
2078
  response_body = ("Failed to upload patch for %s. Got %d status code." %
2071
2079
  (filename, e.code))
2072
2080
 
@@ -2083,8 +2091,8 @@ def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
2083
2091
  rv = []
2084
2092
  for patch in patches:
2085
2093
  if len(patch[1]) > MAX_UPLOAD_SIZE:
2086
- print ("Not uploading the patch for " + patch[0] +
2087
- " because the file is too large.")
2094
+ print("Not uploading the patch for %s because the file is too large." %
2095
+ (patch[0],))
2088
2096
  continue
2089
2097
 
2090
2098
  filename = patch[0]
@@ -2095,7 +2103,7 @@ def UploadSeparatePatches(issue, rpc_server, patchset, data, options):
2095
2103
 
2096
2104
  for t in threads:
2097
2105
  result = t.get(timeout=60)
2098
- print result[0]
2106
+ print(result[0])
2099
2107
  rv.append(result[1])
2100
2108
 
2101
2109
  return rv
@@ -2130,8 +2138,8 @@ def GuessVCSName(options):
2130
2138
  out, returncode = RunShellWithReturnCode(command)
2131
2139
  if returncode == 0:
2132
2140
  return (vcs_type, out.strip())
2133
- except OSError, (errcode, message):
2134
- if errcode != errno.ENOENT: # command not found code
2141
+ except OSError as e:
2142
+ if e.errno != errno.ENOENT: # command not found code
2135
2143
  raise
2136
2144
 
2137
2145
  # Mercurial has a command to get the base directory of a repository
@@ -2238,7 +2246,7 @@ def LoadSubversionAutoProperties():
2238
2246
  subversion_config = os.path.expanduser("~/.subversion/config")
2239
2247
  if not os.path.exists(subversion_config):
2240
2248
  return {}
2241
- config = ConfigParser.ConfigParser()
2249
+ config = configparser.ConfigParser()
2242
2250
  config.read(subversion_config)
2243
2251
  if (config.has_section("miscellany") and
2244
2252
  config.has_option("miscellany", "enable-auto-props") and
@@ -2372,8 +2380,8 @@ def RealMain(argv, data=None):
2372
2380
  guessed_base = vcs.GuessBase(options.download_base)
2373
2381
  if base:
2374
2382
  if guessed_base and base != guessed_base:
2375
- print "Using base URL \"%s\" from --base_url instead of \"%s\"" % \
2376
- (base, guessed_base)
2383
+ print("Using base URL \"%s\" from --base_url instead of \"%s\"" %
2384
+ (base, guessed_base))
2377
2385
  else:
2378
2386
  base = guessed_base
2379
2387
 
@@ -2386,12 +2394,12 @@ def RealMain(argv, data=None):
2386
2394
  data = vcs.GenerateDiff(args)
2387
2395
  data = vcs.PostProcessDiff(data)
2388
2396
  if options.print_diffs:
2389
- print "Rietveld diff start:*****"
2390
- print data
2391
- print "Rietveld diff end:*****"
2397
+ print("Rietveld diff start:*****")
2398
+ print(data)
2399
+ print("Rietveld diff end:*****")
2392
2400
  files = vcs.GetBaseFiles(data)
2393
2401
  if verbosity >= 1:
2394
- print "Upload server:", options.server, "(change with -s/--server)"
2402
+ print("Upload server:", options.server, "(change with -s/--server)")
2395
2403
 
2396
2404
  auth_config = auth.extract_auth_config_from_options(options)
2397
2405
  rpc_server = GetRpcServer(options.server, auth_config, options.email)
@@ -2432,6 +2440,7 @@ def RealMain(argv, data=None):
2432
2440
 
2433
2441
  # Process --message, --title and --file.
2434
2442
  message = options.message or ""
2443
+ explicit_title = options.title is not None
2435
2444
  title = options.title or ""
2436
2445
  if options.file:
2437
2446
  if options.message:
@@ -2440,7 +2449,7 @@ def RealMain(argv, data=None):
2440
2449
  message = file.read()
2441
2450
  file.close()
2442
2451
  title = title or message.split('\n', 1)[0].strip()
2443
- if not title:
2452
+ if not title and not explicit_title:
2444
2453
  if options.issue:
2445
2454
  prompt = "Title describing this patch set"
2446
2455
  else:
@@ -2477,7 +2486,7 @@ def RealMain(argv, data=None):
2477
2486
  form_fields.append(("base_hashes", base_hashes))
2478
2487
  if options.private:
2479
2488
  if options.issue:
2480
- print "Warning: Private flag ignored when updating an existing issue."
2489
+ print("Warning: Private flag ignored when updating an existing issue.")
2481
2490
  else:
2482
2491
  form_fields.append(("private", "1"))
2483
2492
  if options.send_patch:
@@ -2485,7 +2494,7 @@ def RealMain(argv, data=None):
2485
2494
  if not options.download_base:
2486
2495
  form_fields.append(("content_upload", "1"))
2487
2496
  if len(data) > MAX_UPLOAD_SIZE:
2488
- print "Patch is large, so uploading file patches separately."
2497
+ print("Patch is large, so uploading file patches separately.")
2489
2498
  uploaded_diff_file = []
2490
2499
  form_fields.append(("separate_patches", "1"))
2491
2500
  else:
@@ -2544,7 +2553,7 @@ def main():
2544
2553
  StatusUpdate("Interrupted.")
2545
2554
  sys.exit(1)
2546
2555
  except auth.AuthenticationError as e:
2547
- print >> sys.stderr, e
2556
+ print(e, file=sys.stderr)
2548
2557
  sys.exit(1)
2549
2558
 
2550
2559