| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 188 |
| 189 | 189 |
| 190 # Wrapper for side effects. | 190 # Wrapper for side effects. |
| 191 class SideEffectHandler(object): | 191 class SideEffectHandler(object): |
| 192 def Command(self, cmd, args="", prefix="", pipe=True): | 192 def Command(self, cmd, args="", prefix="", pipe=True): |
| 193 return Command(cmd, args, prefix, pipe) | 193 return Command(cmd, args, prefix, pipe) |
| 194 | 194 |
| 195 def ReadLine(self): | 195 def ReadLine(self): |
| 196 return sys.stdin.readline().strip() | 196 return sys.stdin.readline().strip() |
| 197 | 197 |
| 198 def ReadURL(self, url): | 198 def ReadURL(self, url, params=None): |
| 199 # pylint: disable=E1121 | 199 # pylint: disable=E1121 |
| 200 url_fh = urllib2.urlopen(url, None, 60) | 200 url_fh = urllib2.urlopen(url, params, 60) |
| 201 try: | 201 try: |
| 202 return url_fh.read() | 202 return url_fh.read() |
| 203 finally: | 203 finally: |
| 204 url_fh.close() | 204 url_fh.close() |
| 205 | 205 |
| 206 def Sleep(self, seconds): | 206 def Sleep(self, seconds): |
| 207 time.sleep(seconds) | 207 time.sleep(seconds) |
| 208 | 208 |
| 209 def GetDate(self): | 209 def GetDate(self): |
| 210 return datetime.date.today().strftime("%Y-%m-%d") | 210 return datetime.date.today().strftime("%Y-%m-%d") |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 def Git(self, args="", prefix="", pipe=True, retry_on=None): | 297 def Git(self, args="", prefix="", pipe=True, retry_on=None): |
| 298 cmd = lambda: self._side_effect_handler.Command("git", args, prefix, pipe) | 298 cmd = lambda: self._side_effect_handler.Command("git", args, prefix, pipe) |
| 299 return self.Retry(cmd, retry_on, [5, 30]) | 299 return self.Retry(cmd, retry_on, [5, 30]) |
| 300 | 300 |
| 301 def Editor(self, args): | 301 def Editor(self, args): |
| 302 if self._options.requires_editor: | 302 if self._options.requires_editor: |
| 303 return self._side_effect_handler.Command(os.environ["EDITOR"], args, | 303 return self._side_effect_handler.Command(os.environ["EDITOR"], args, |
| 304 pipe=False) | 304 pipe=False) |
| 305 | 305 |
| 306 def ReadURL(self, url, retry_on=None, wait_plan=None): | 306 def ReadURL(self, url, params=None, retry_on=None, wait_plan=None): |
| 307 wait_plan = wait_plan or [3, 60, 600] | 307 wait_plan = wait_plan or [3, 60, 600] |
| 308 cmd = lambda: self._side_effect_handler.ReadURL(url) | 308 cmd = lambda: self._side_effect_handler.ReadURL(url, params) |
| 309 return self.Retry(cmd, retry_on, wait_plan) | 309 return self.Retry(cmd, retry_on, wait_plan) |
| 310 | 310 |
| 311 def GetDate(self): | 311 def GetDate(self): |
| 312 return self._side_effect_handler.GetDate() | 312 return self._side_effect_handler.GetDate() |
| 313 | 313 |
| 314 def Die(self, msg=""): | 314 def Die(self, msg=""): |
| 315 if msg != "": | 315 if msg != "": |
| 316 print "Error: %s" % msg | 316 print "Error: %s" % msg |
| 317 print "Exiting" | 317 print "Exiting" |
| 318 raise Exception(msg) | 318 raise Exception(msg) |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 options, | 498 options, |
| 499 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): | 499 side_effect_handler=DEFAULT_SIDE_EFFECT_HANDLER): |
| 500 state = {} | 500 state = {} |
| 501 steps = [] | 501 steps = [] |
| 502 for (number, step_class) in enumerate(step_classes): | 502 for (number, step_class) in enumerate(step_classes): |
| 503 steps.append(MakeStep(step_class, number, state, config, | 503 steps.append(MakeStep(step_class, number, state, config, |
| 504 options, side_effect_handler)) | 504 options, side_effect_handler)) |
| 505 | 505 |
| 506 for step in steps[options.s:]: | 506 for step in steps[options.s:]: |
| 507 step.Run() | 507 step.Run() |
| OLD | NEW |