Chromium Code Reviews| Index: mojo/public/tools/download_shell_binary.py |
| diff --git a/mojo/public/tools/download_shell_binary.py b/mojo/public/tools/download_shell_binary.py |
| index 30891c20e2f37ba5e38702bddea597e7b78ad9de..9841860db0eebd6f40eb8b06bb404bb94f24cb29 100755 |
| --- a/mojo/public/tools/download_shell_binary.py |
| +++ b/mojo/public/tools/download_shell_binary.py |
| @@ -4,6 +4,7 @@ |
| # found in the LICENSE file. |
| import argparse |
| +import gs |
| import os |
| import subprocess |
| import sys |
| @@ -47,41 +48,13 @@ def download(tools_directory): |
| def download_version_for_platform(version, platform, tools_directory): |
| find_depot_tools_path = os.path.join(CURRENT_PATH, tools_directory) |
| - sys.path.insert(0, find_depot_tools_path) |
| - # pylint: disable=F0401 |
| - import find_depot_tools |
| basename = platform + ".zip" |
| gs_path = "gs://mojo/shell/" + version + "/" + basename |
| - depot_tools_path = find_depot_tools.add_depot_tools_to_path() |
| - gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil") |
| - |
| with tempfile.NamedTemporaryFile() as temp_zip_file: |
| - # We're downloading from a public bucket which does not need authentication, |
| - # but the user might have busted credential files somewhere such as ~/.boto |
| - # that the gsutil script will try (and fail) to use. Setting these |
| - # environment variables convinces gsutil not to attempt to use these, but |
| - # also generates a useless warning about failing to load the file. We want |
| - # to discard this warning but still preserve all output in the case of an |
| - # actual failure. So, we run the script and capture all output and then |
| - # throw the output away if the script succeeds (return code 0). |
| - env = os.environ.copy() |
| - env["AWS_CREDENTIAL_FILE"] = "" |
| - env["BOTO_CONFIG"] = "" |
| - try: |
| - subprocess.check_output( |
| - [gsutil_exe, |
| - "--bypass_prodaccess", |
| - "cp", |
| - gs_path, |
| - temp_zip_file.name], |
| - stderr=subprocess.STDOUT, |
| - env=env) |
| - except subprocess.CalledProcessError as e: |
| - print e.output |
| - sys.exit(1) |
| - |
| + gs.download_from_public_bucket(gs_path, temp_zip_file.name, |
| + find_depot_tools_path) |
| binary_name = BINARY_FOR_PLATFORM[platform] |
| output_dir = os.path.join(PREBUILT_FILE_PATH, platform) |
| with zipfile.ZipFile(temp_zip_file.name) as z: |
| @@ -103,7 +76,7 @@ def main(): |
| " from the location of this file.") |
| args = parser.parse_args() |
| if not args.tools_directory: |
| - print "Must specify --tools_directory; please see help message." |
| + print "Must specify --tools-directory; please see help message." |
|
viettrungluu
2015/02/11 23:54:49
...
blundell
2015/02/12 09:06:33
Done.
|
| sys.exit(1) |
| return download(args.tools_directory) |