OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 |
| 3 import os |
| 4 import subprocess |
| 5 import tempfile |
| 6 import time |
| 7 import zipfile |
| 8 |
| 9 root_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), |
| 10 "..", "..") |
| 11 version_path = os.path.join(root_path, "mojo", "public", "VERSION") |
| 12 version_file = open(version_path) |
| 13 version = version_file.read().strip() |
| 14 |
| 15 binary_path = os.path.join(root_path, "out", "Release", "mojo_shell") |
| 16 |
| 17 dest = "gs://mojo/shell/" + version + "/linux-x64.zip" |
| 18 |
| 19 with tempfile.NamedTemporaryFile() as zip_file: |
| 20 with zipfile.ZipFile(zip_file, 'w') as z: |
| 21 with open(binary_path) as shell_binary: |
| 22 zipinfo = zipfile.ZipInfo("mojo_shell") |
| 23 zipinfo.external_attr = 0777 << 16L |
| 24 zipinfo.compress_type = zipfile.ZIP_DEFLATED |
| 25 zipinfo.date_time = time.gmtime(os.path.getmtime(binary_path)) |
| 26 z.writestr(zipinfo, shell_binary.read()) |
| 27 subprocess.check_call(["gsutil", "cp", zip_file.name, dest]) |
OLD | NEW |