| OLD | NEW |
| (Empty) |
| 1 #!/usr/bin/env python | |
| 2 # Copyright 2014 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 sys | |
| 9 import tempfile | |
| 10 import time | |
| 11 import zipfile | |
| 12 | |
| 13 root_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), | |
| 14 "..", "..") | |
| 15 version_path = os.path.join(root_path, "mojo", "public", "VERSION") | |
| 16 version_file = open(version_path) | |
| 17 version = version_file.read().strip() | |
| 18 | |
| 19 sys.path.insert(0, os.path.join(root_path, "tools")) | |
| 20 # pylint: disable=F0401 | |
| 21 import find_depot_tools | |
| 22 | |
| 23 | |
| 24 binary_path = os.path.join(root_path, "out", "Release", "mojo_shell") | |
| 25 | |
| 26 dest = "gs://mojo/shell/" + version + "/linux-x64.zip" | |
| 27 | |
| 28 depot_tools_path = find_depot_tools.add_depot_tools_to_path() | |
| 29 gsutil_exe = os.path.join(depot_tools_path, "third_party", "gsutil", "gsutil") | |
| 30 | |
| 31 with tempfile.NamedTemporaryFile() as zip_file: | |
| 32 with zipfile.ZipFile(zip_file, 'w') as z: | |
| 33 with open(binary_path) as shell_binary: | |
| 34 zipinfo = zipfile.ZipInfo("mojo_shell") | |
| 35 zipinfo.external_attr = 0777 << 16L | |
| 36 zipinfo.compress_type = zipfile.ZIP_DEFLATED | |
| 37 zipinfo.date_time = time.gmtime(os.path.getmtime(binary_path)) | |
| 38 z.writestr(zipinfo, shell_binary.read()) | |
| 39 subprocess.check_call([gsutil_exe, "cp", zip_file.name, dest]) | |
| OLD | NEW |