OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2016 Google Inc. | 3 # Copyright 2016 Google Inc. |
4 # | 4 # |
5 # Use of this source code is governed by a BSD-style license that can be | 5 # Use of this source code is governed by a BSD-style license that can be |
6 # found in the LICENSE file. | 6 # found in the LICENSE file. |
7 | 7 |
8 | 8 |
9 """Create the asset.""" | 9 """Create the asset.""" |
10 | 10 |
11 | 11 |
12 import argparse | 12 import argparse |
| 13 import common |
| 14 import subprocess |
| 15 import os |
| 16 |
| 17 |
| 18 SVG_TOOLS = os.path.join(common.INFRA_BOTS_DIR, os.pardir, os.pardir, 'tools', |
| 19 'svg') |
13 | 20 |
14 | 21 |
15 def create_asset(target_dir): | 22 def create_asset(target_dir): |
16 """Create the asset.""" | 23 """Create the asset.""" |
17 raise NotImplementedError('Implement me!') | 24 target_dir = os.path.realpath(target_dir) |
| 25 |
| 26 if not os.path.exists(target_dir): |
| 27 os.makedirs(target_dir) |
| 28 |
| 29 download_svgs_cmd = [ |
| 30 'python', os.path.join(SVG_TOOLS, 'svg_downloader.py'), |
| 31 '--output_dir', target_dir, |
| 32 ] |
| 33 subprocess.check_call(download_svgs_cmd) |
18 | 34 |
19 | 35 |
20 def main(): | 36 def main(): |
21 parser = argparse.ArgumentParser() | 37 parser = argparse.ArgumentParser() |
22 parser.add_argument('--target_dir', '-t', required=True) | 38 parser.add_argument('--target_dir', '-t', required=True) |
23 args = parser.parse_args() | 39 args = parser.parse_args() |
24 create_asset(args.target_dir) | 40 create_asset(args.target_dir) |
25 | 41 |
26 | 42 |
27 if __name__ == '__main__': | 43 if __name__ == '__main__': |
28 main() | 44 main() |
OLD | NEW |