Download material design SVGs from Google Storage
NoTry: true Bug: skia:6865 Change-Id: Id857d6ad0b5cdccbadb11810bf07a093467544ec Reviewed-on: https://skia-review.googlesource.com/24086 Commit-Queue: Ravi Mistry <rmistry@google.com> Reviewed-by: Eric Boren <borenet@google.com>
This commit is contained in:
parent
430e4c84e9
commit
d81977f51b
@ -18,9 +18,10 @@ import shutil
|
||||
|
||||
SVG_TOOLS = os.path.join(common.INFRA_BOTS_DIR, os.pardir, os.pardir, 'tools',
|
||||
'svg')
|
||||
SVG_GS_BUCKET = 'gs://skia-svgs'
|
||||
|
||||
|
||||
def create_asset(local_svgs_dir, target_dir):
|
||||
def create_asset(target_dir):
|
||||
"""Create the asset."""
|
||||
target_dir = os.path.realpath(target_dir)
|
||||
|
||||
@ -34,19 +35,21 @@ def create_asset(local_svgs_dir, target_dir):
|
||||
]
|
||||
subprocess.check_call(download_svgs_cmd)
|
||||
|
||||
# Copy over the SVGs from local_svgs_dir (if any).
|
||||
if local_svgs_dir and os.path.exists(local_svgs_dir):
|
||||
for svg_filename in os.listdir(local_svgs_dir):
|
||||
shutil.copy(src=os.path.join(local_svgs_dir, svg_filename),
|
||||
dst=os.path.join(target_dir, svg_filename))
|
||||
# Download SVGs from Google storage. These are material design SVGs from
|
||||
# skbug.com/5757.
|
||||
# There was no easy way to create URLs from them to specify in
|
||||
# tools/svg/svgs.txt which is why they had been stored in Google storage.
|
||||
subprocess.check_call([
|
||||
'gsutil', '-m', 'cp', os.path.join(SVG_GS_BUCKET, 'skbug5757', '*'),
|
||||
target_dir
|
||||
])
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--local_svgs_dir', '-l', default='')
|
||||
parser.add_argument('--target_dir', '-t', required=True)
|
||||
args = parser.parse_args()
|
||||
create_asset(args.local_svgs_dir, args.target_dir)
|
||||
create_asset(args.target_dir)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user