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

Side by Side Diff: tools/telemetry/catapult_base/dependency_manager/cloud_storage_info.py

Issue 1502033002: Revert of [Android] Add a configurable environment for devil/. (RELAND 2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « build/java_apk.gypi ('k') | tools/telemetry/telemetry/internal/platform/android_device.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import errno
6 import logging 5 import logging
7 import os 6 import os
8 import stat 7 import stat
9 8
10 from catapult_base import cloud_storage 9 from catapult_base import cloud_storage
11 10
12 from catapult_base.dependency_manager import exceptions 11 from catapult_base.dependency_manager import exceptions
13 12
14 class CloudStorageInfo(object): 13 class CloudStorageInfo(object):
15 def __init__(self, cs_bucket, cs_hash, download_path, cs_remote_path, 14 def __init__(self, cs_bucket, cs_hash, download_path, cs_remote_path,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 needed file. 56 needed file.
58 CloudStorageError: If another error occured while downloading the remote 57 CloudStorageError: If another error occured while downloading the remote
59 path. 58 path.
60 FileNotFoundError: If the download was otherwise unsuccessful. 59 FileNotFoundError: If the download was otherwise unsuccessful.
61 """ 60 """
62 if not self._has_minimum_data: 61 if not self._has_minimum_data:
63 return None 62 return None
64 63
65 download_dir = os.path.dirname(self._download_path) 64 download_dir = os.path.dirname(self._download_path)
66 if not os.path.exists(download_dir): 65 if not os.path.exists(download_dir):
67 try: 66 os.makedirs(download_dir)
68 os.makedirs(download_dir)
69 except OSError as e:
70 # The logic above is racy, and os.makedirs will raise an OSError if
71 # the directory exists.
72 if e.errno != errno.EEXIST:
73 raise
74 67
75 dependency_path = self._download_path 68 dependency_path = self._download_path
76 cloud_storage.GetIfHashChanged( 69 cloud_storage.GetIfHashChanged(
77 self._cs_remote_path, self._download_path, self._cs_bucket, 70 self._cs_remote_path, self._download_path, self._cs_bucket,
78 self._cs_hash) 71 self._cs_hash)
79 if not os.path.exists(dependency_path): 72 if not os.path.exists(dependency_path):
80 raise exceptions.FileNotFoundError(dependency_path) 73 raise exceptions.FileNotFoundError(dependency_path)
81 74
82 logging.error('has archive_info %s', self._archive_info) 75 logging.error('has archive_info %s', self._archive_info)
83 if self.has_archive_info: 76 if self.has_archive_info:
(...skipping 16 matching lines...) Expand all
100 @property 93 @property
101 def has_archive_info(self): 94 def has_archive_info(self):
102 return bool(self._archive_info) 95 return bool(self._archive_info)
103 96
104 def __repr__(self): 97 def __repr__(self):
105 return ( 98 return (
106 'CloudStorageInfo(download_path=%s, cs_remote_path=%s, cs_bucket=%s, ' 99 'CloudStorageInfo(download_path=%s, cs_remote_path=%s, cs_bucket=%s, '
107 'cs_hash=%s, version_in_cs=%s, archive_info=%s)' % ( 100 'cs_hash=%s, version_in_cs=%s, archive_info=%s)' % (
108 self._download_path, self._cs_remote_path, self._cs_bucket, 101 self._download_path, self._cs_remote_path, self._cs_bucket,
109 self._cs_hash, self._version_in_cs, self._archive_info)) 102 self._cs_hash, self._version_in_cs, self._archive_info))
OLDNEW
« no previous file with comments | « build/java_apk.gypi ('k') | tools/telemetry/telemetry/internal/platform/android_device.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698