diff options
author | blundell <blundell@chromium.org> | 2015-01-19 09:18:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-19 17:19:27 +0000 |
commit | 70fb54767b472a5edfb859e489beeeec7abdb0e4 (patch) | |
tree | 28e534ec774391a9f6571a1770e12a0d63ebf833 /mojo/public/tools/download_shell_binary.py | |
parent | ba5f0233fa38f949e24f6274ba891fa652eab640 (diff) | |
download | chromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.zip chromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.tar.gz chromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.tar.bz2 |
Move //mojo/{public, edk} underneath //third_party
This CL move //mojo/public and //mojo/edk to live in the following locations:
- //third_party/mojo/src/mojo/public
- //third_party/mojo/src/mojo/edk
It moves the related gypfiles from //mojo to //third_party/mojo and updates
them as necessary to account for the file moves. It also updates clients of the
mojo SDK and EDK targets in both GYP and GN. (Note that for GN, the mojo SDK
and EDK build systems are maintained in the Mojo repo and designed to be
flexible wrt the location of the SDK/EDK in a client repo, so no changes are
needed.
This CL does not update include paths to the code being moved to limit the
number of moving parts, instead relying on the include_dirs that the SDK and
EDK targets supply to their direct dependents to ensure that include paths
continue to resolve correctly.
NOPRESUBMIT=true
Review URL: https://codereview.chromium.org/814543006
Cr-Commit-Position: refs/heads/master@{#312129}
Diffstat (limited to 'mojo/public/tools/download_shell_binary.py')
-rwxr-xr-x | mojo/public/tools/download_shell_binary.py | 101 |
1 files changed, 0 insertions, 101 deletions
diff --git a/mojo/public/tools/download_shell_binary.py b/mojo/public/tools/download_shell_binary.py deleted file mode 100755 index b46139e..0000000 --- a/mojo/public/tools/download_shell_binary.py +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env python -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import argparse -import os -import subprocess -import sys -import tempfile -import zipfile - -if not sys.platform.startswith("linux"): - print "Not supported for your platform" - sys.exit(0) - - -def download(tools_directory): - current_path = os.path.dirname(os.path.realpath(__file__)) - 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 - - prebuilt_file_path = os.path.join(current_path, "prebuilt") - stamp_path = os.path.join(prebuilt_file_path, "VERSION") - - depot_tools_path = find_depot_tools.add_depot_tools_to_path() - gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil") - - version_path = os.path.join(current_path, "../VERSION") - with open(version_path) as version_file: - version = version_file.read().strip() - - try: - with open(stamp_path) as stamp_file: - current_version = stamp_file.read().strip() - if current_version == version: - return 0 # Already have the right version. - except IOError: - pass # If the stamp file does not exist we need to download a new binary. - - platform = "linux-x64" # TODO: configurate - basename = platform + ".zip" - - gs_path = "gs://mojo/shell/" + version + "/" + basename - - 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) - - with zipfile.ZipFile(temp_zip_file.name) as z: - zi = z.getinfo("mojo_shell") - mode = zi.external_attr >> 16 - z.extract(zi, prebuilt_file_path) - os.chmod(os.path.join(prebuilt_file_path, "mojo_shell"), mode) - - with open(stamp_path, 'w') as stamp_file: - stamp_file.write(version) - return 0 - - -def main(): - parser = argparse.ArgumentParser(description="Download mojo_shell binary " - "from google storage") - parser.add_argument("--tools-directory", - dest="tools_directory", - metavar="<tools-directory>", - type=str, - help="Path to the directory containing" - " find_depot_tools.py, specified as a relative path" - " from the location of this file.") - args = parser.parse_args() - if not args.tools_directory: - print "Must specify --tools_directory; please see help message." - sys.exit(1) - return download(args.tools_directory) - -if __name__ == "__main__": - sys.exit(main()) |