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

Unified Diff: download_from_google_storage.py

Issue 86123002: Adds SSO auth to gsutil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Added bypass support Created 7 years, 1 month 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 | tests/download_from_google_storage_unittests.py » ('j') | third_party/gsutil/gslib/util.py » ('J')
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 e00ac626218be3efd1c1014a1760b6d0879a6f3a..29368d7d7067b7caa5a0c5a9811275712c311818 100755
--- a/download_from_google_storage.py
+++ b/download_from_google_storage.py
@@ -36,12 +36,13 @@ class InvalidFileError(IOError):
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):
+ def __init__(self, path, boto_path, timeout=None, bypass_prodaccess=False):
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 = False
def get_sub_env(self):
env = os.environ.copy()
@@ -60,11 +61,15 @@ class Gsutil(object):
return env
def call(self, *args):
+ if self.bypass_prodaccess:
+ args.insert(0, '--bypass_prodaccess')
return subprocess2.call((sys.executable, self.path) + args,
env=self.get_sub_env(),
timeout=self.timeout)
def check_call(self, *args):
+ if self.bypass_prodaccess:
+ args.insert(0, '--bypass_prodaccess')
((out, err), code) = subprocess2.communicate(
(sys.executable, self.path) + args,
stdout=subprocess2.PIPE,
@@ -324,12 +329,16 @@ def main(args):
# Make sure we can find a working instance of gsutil.
if os.path.exists(GSUTIL_DEFAULT_PATH):
- gsutil = Gsutil(GSUTIL_DEFAULT_PATH, boto_path=options.boto)
+ gsutil = Gsutil(GSUTIL_DEFAULT_PATH,
+ boto_path=options.boto,
+ bypass_prodaccess=options.no_auth)
else:
gsutil = None
for path in os.environ["PATH"].split(os.pathsep):
if os.path.exists(path) and 'gsutil' in os.listdir(path):
- gsutil = Gsutil(os.path.join(path, 'gsutil'), boto_path=options.boto)
+ gsutil = Gsutil(os.path.join(path, 'gsutil'),
+ boto_path=options.boto,
+ bypass_prodaccess=False)
if not gsutil:
parser.error('gsutil not found in %s, bad depot_tools checkout?' %
GSUTIL_DEFAULT_PATH)
« no previous file with comments | « no previous file | tests/download_from_google_storage_unittests.py » ('j') | third_party/gsutil/gslib/util.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698