Flutter Engine
The Flutter Engine
create_and_upload.py
Go to the documentation of this file.
1#!/usr/bin/env python
2#
3# Copyright 2017 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."""
10
11
12import argparse
13import os
14import subprocess
15import sys
16
17FILE_DIR = os.path.dirname(os.path.abspath(__file__))
18INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir))
19sys.path.insert(0, INFRA_BOTS_DIR)
20import utils
21
22
23def main():
24 parser = argparse.ArgumentParser()
25 parser.add_argument('--gsutil')
26 args = parser.parse_args()
27
28 with utils.tmp_dir():
29 cwd = os.getcwd()
30 create_script = os.path.join(FILE_DIR, 'create.py')
31 upload_script = os.path.join(FILE_DIR, 'upload.py')
32
33 try:
34 subprocess.check_call(['python', create_script, '-t', cwd])
35 cmd = ['python', upload_script, '-t', cwd]
36 if args.gsutil:
37 cmd.extend(['--gsutil', args.gsutil])
38 subprocess.check_call(cmd)
39 except subprocess.CalledProcessError:
40 # Trap exceptions to avoid printing two stacktraces.
41 sys.exit(1)
42
43
44if __name__ == '__main__':
45 main()
Definition: main.py:1