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

Unified Diff: client/cipd.py

Issue 2186263002: luci-py: Refactor file writing code to allow file objects. (Closed) Base URL: https://github.com/luci/luci-py.git@master
Patch Set: Rebase Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | client/isolateserver.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/cipd.py
diff --git a/client/cipd.py b/client/cipd.py
index 764fb09d660a068437ae7073054c444dc65ae16f..8881ef2ecad75d22fd150ea8733fd230e25d6854 100644
--- a/client/cipd.py
+++ b/client/cipd.py
@@ -368,7 +368,8 @@ def get_client(
# cache by hashing it.
version_digest = hashlib.sha1(version).hexdigest()
try:
- instance_id = version_cache.read(version_digest)
+ with version_cache.getfileobj(version_digest) as f:
+ instance_id = f.read()
except isolateserver.CacheMiss:
instance_id = resolve_version(
service_url, package_name, version, timeout=timeoutfn())
@@ -394,7 +395,9 @@ def get_client(
binary_path = unicode(os.path.join(cache_dir, 'cipd' + EXECUTABLE_SUFFIX))
if fs.isfile(binary_path):
file_path.remove(binary_path)
- instance_cache.link(instance_id, binary_path, 0511, False) # -r-x--x--x
+
+ with instance_cache.getfileobj(instance_id) as f:
+ isolateserver.putfile(f, binary_path, 0511) # -r-x--x--x
yield CipdClient(binary_path)
« no previous file with comments | « no previous file | client/isolateserver.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698