Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: client/utils/tools.py

Issue 2037253002: run_isolated.py: install CIPD packages (Closed) Base URL: https://chromium.googlesource.com/external/github.com/luci/luci-py@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« client/utils/subprocess42.py ('K') | « client/utils/subprocess42.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The LUCI Authors. All rights reserved. 1 # Copyright 2013 The LUCI Authors. All rights reserved.
2 # Use of this source code is governed under the Apache License, Version 2.0 2 # Use of this source code is governed under the Apache License, Version 2.0
3 # that can be found in the LICENSE file. 3 # that can be found in the LICENSE file.
4 4
5 """Various utility functions and classes not specific to any single area.""" 5 """Various utility functions and classes not specific to any single area."""
6 6
7 import atexit 7 import atexit
8 import cStringIO 8 import cStringIO
9 import functools 9 import functools
10 import json 10 import json
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 a zip archive, we need to extract the file first. 309 a zip archive, we need to extract the file first.
310 """ 310 """
311 global _ca_certs 311 global _ca_certs
312 with _ca_certs_lock: 312 with _ca_certs_lock:
313 if _ca_certs is not None and os.path.exists(_ca_certs): 313 if _ca_certs is not None and os.path.exists(_ca_certs):
314 return _ca_certs 314 return _ca_certs
315 # Some rogue process clears /tmp and causes cacert.pem to disappear. Extract 315 # Some rogue process clears /tmp and causes cacert.pem to disappear. Extract
316 # to current directory instead. We use our own bundled copy of cacert.pem. 316 # to current directory instead. We use our own bundled copy of cacert.pem.
317 _ca_certs = zip_package.extract_resource(utils, 'cacert.pem', temp_dir='.') 317 _ca_certs = zip_package.extract_resource(utils, 'cacert.pem', temp_dir='.')
318 return _ca_certs 318 return _ca_certs
319
320
321 class Timeouter(object):
Vadim Sh. 2016/06/06 21:32:14 not sure it's worth the dedicated class... I don't
M-A Ruel 2016/06/06 23:34:51 I agree.
nodir 2016/06/07 18:46:35 changed to a function that returns a closure
322 """Computes time left till deadline."""
323
324 def __init__(self, timeout):
325 self.deadline = time.time() + timeout if timeout is not None else None
326
327 def left(self):
328 return self.deadline - time.time() if self.deadline is not None else None
OLDNEW
« client/utils/subprocess42.py ('K') | « client/utils/subprocess42.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698