Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # | |
| 3 # Copyright 2016 Google Inc. | |
| 4 # | |
| 5 # Use of this source code is governed by a BSD-style license that can be | |
| 6 # found in the LICENSE file. | |
| 7 | |
| 8 | |
| 9 """Create the asset and upload it.""" | |
|
rmistry
2016/06/15 13:47:18
[Optional]
Will need more maintenance work to keep
borenet
2016/06/15 14:31:27
IMO being able to create and upload the asset from
| |
| 10 | |
| 11 | |
| 12 import argparse | |
| 13 import os | |
| 14 import subprocess | |
| 15 import sys | |
| 16 | |
| 17 FILE_DIR = os.path.dirname(os.path.abspath(__file__)) | |
| 18 INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir)) | |
| 19 | |
| 20 sys.path.insert(0, INFRA_BOTS_DIR) | |
| 21 import utils | |
| 22 | |
| 23 | |
| 24 def main(): | |
| 25 parser = argparse.ArgumentParser() | |
| 26 parser.add_argument('--gsutil') | |
| 27 args = parser.parse_args() | |
| 28 | |
| 29 with utils.tmp_dir(): | |
| 30 cwd = os.getcwd() | |
| 31 create_script = os.path.join(FILE_DIR, 'create.py') | |
| 32 upload_script = os.path.join(FILE_DIR, 'upload.py') | |
| 33 | |
| 34 try: | |
| 35 subprocess.check_call(['python', create_script, '-t', cwd]) | |
| 36 subprocess.check_call(['python', upload_script, '-t', cwd, | |
| 37 '--gsutil', args.gsutil]) | |
| 38 except subprocess.CalledProcessError: | |
| 39 # Trap exceptions to avoid printing two stacktraces. | |
| 40 sys.exit(1) | |
| 41 | |
| 42 | |
| 43 if __name__ == '__main__': | |
| 44 main() | |
| OLD | NEW |