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

Side by Side Diff: tools/gs.py

Issue 869193005: Set up a network service bootstrap. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Extract gs.py. Created 5 years, 11 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 unified diff | Download patch
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 import os
7 import subprocess
8 import find_depot_tools
9
10 def download_from_public_bucket(gs_path, output_path):
11 depot_tools_path = find_depot_tools.add_depot_tools_to_path()
12 gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil")
13
14 # We're downloading from a public bucket which does not need authentication,
15 # but the user might have busted credential files somewhere such as ~/.boto
16 # that the gsutil script will try (and fail) to use. Setting these
17 # environment variables convinces gsutil not to attempt to use these, but
18 # also generates a useless warning about failing to load the file. We want
19 # to discard this warning but still preserve all output in the case of an
20 # actual failure. So, we run the script and capture all output and then
21 # throw the output away if the script succeeds (return code 0).
22 env = os.environ.copy()
23 env["AWS_CREDENTIAL_FILE"] = ""
24 env["BOTO_CONFIG"] = ""
25 try:
26 subprocess.check_output(
27 [gsutil_exe,
28 "--bypass_prodaccess",
29 "cp",
30 gs_path,
31 output_path],
32 stderr=subprocess.STDOUT,
33 env=env)
34 except subprocess.CalledProcessError as e:
35 print e.output
36 sys.exit(1)
OLDNEW
« services/network/download_network_service.py ('K') | « services/network/download_network_service.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698