| 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)
|
|
|