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

Unified Diff: download_from_google_storage.py

Issue 797663003: Use gsutil.py for download_from_google_storage instead of the builtin one (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Also modifies references in git_cache, upload_to_google_storage Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | git_cache.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: download_from_google_storage.py
diff --git a/download_from_google_storage.py b/download_from_google_storage.py
index 999ef722a879de0e0315bb5b6bad83b4c2de975f..f73b3bd0af547d1e808d52a30b553e1ccf5af47d 100755
--- a/download_from_google_storage.py
+++ b/download_from_google_storage.py
@@ -20,8 +20,7 @@ import subprocess2
GSUTIL_DEFAULT_PATH = os.path.join(
- os.path.dirname(os.path.abspath(__file__)),
- 'third_party', 'gsutil', 'gsutil')
+ os.path.dirname(os.path.abspath(__file__)), 'gsutil.py')
# Maps sys.platform to what we actually want to call them.
PLATFORM_MAPPING = {
'cygwin': 'win',
@@ -55,13 +54,13 @@ def GetNormalizedPlatform():
class Gsutil(object):
"""Call gsutil with some predefined settings. This is a convenience object,
and is also immutable."""
- def __init__(self, path, boto_path, timeout=None, bypass_prodaccess=False):
+ def __init__(self, path, boto_path, timeout=None, version='4.7'):
if not os.path.exists(path):
raise FileNotFoundError('GSUtil not found in %s' % path)
self.path = path
self.timeout = timeout
self.boto_path = boto_path
- self.bypass_prodaccess = bypass_prodaccess
+ self.version = version
def get_sub_env(self):
env = os.environ.copy()
@@ -80,16 +79,12 @@ class Gsutil(object):
return env
def call(self, *args):
- cmd = [sys.executable, self.path]
- if self.bypass_prodaccess:
- cmd.append('--bypass_prodaccess')
+ cmd = [sys.executable, self.path, '--force-version', self.version]
cmd.extend(args)
return subprocess2.call(cmd, env=self.get_sub_env(), timeout=self.timeout)
def check_call(self, *args):
- cmd = [sys.executable, self.path]
- if self.bypass_prodaccess:
- cmd.append('--bypass_prodaccess')
+ cmd = [sys.executable, self.path, '--force-version', self.version]
cmd.extend(args)
((out, err), code) = subprocess2.communicate(
cmd,
@@ -237,7 +232,7 @@ def _downloader_worker_thread(thread_num, q, force, base_url,
if os.path.exists(output_filename):
out_q.put('%d> Warning: deleting %s failed.' % (
thread_num, output_filename))
- code, _, err = gsutil.check_call('cp', '-q', file_url, output_filename)
+ code, _, err = gsutil.check_call('cp', file_url, output_filename)
if code != 0:
out_q.put('%d> %s' % (thread_num, err))
ret_codes.put((code, err))
@@ -398,8 +393,7 @@ def main(args):
# Make sure gsutil exists where we expect it to.
if os.path.exists(GSUTIL_DEFAULT_PATH):
gsutil = Gsutil(GSUTIL_DEFAULT_PATH,
- boto_path=options.boto,
- bypass_prodaccess=options.no_auth)
+ boto_path=options.boto)
else:
parser.error('gsutil not found in %s, bad depot_tools checkout?' %
GSUTIL_DEFAULT_PATH)
« no previous file with comments | « no previous file | git_cache.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698