Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(980)

Unified Diff: infra/bots/assets/svg/create.py

Issue 2346663003: Add ability to create and upload SVGs from a local dir (Closed)
Patch Set: Fix default Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | infra/bots/assets/svg/create_and_upload.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: infra/bots/assets/svg/create.py
diff --git a/infra/bots/assets/svg/create.py b/infra/bots/assets/svg/create.py
index 543831a8b57b9346bf30a0f76f632b5fc5a02165..2b9df463e5a0fbc97edaf4d7f263019be261212e 100755
--- a/infra/bots/assets/svg/create.py
+++ b/infra/bots/assets/svg/create.py
@@ -13,31 +13,40 @@ import argparse
import common
import subprocess
import os
+import shutil
SVG_TOOLS = os.path.join(common.INFRA_BOTS_DIR, os.pardir, os.pardir, 'tools',
'svg')
-def create_asset(target_dir):
+def create_asset(local_svgs_dir, target_dir):
"""Create the asset."""
target_dir = os.path.realpath(target_dir)
if not os.path.exists(target_dir):
os.makedirs(target_dir)
+ # Download the SVGs specified in tools/svg/svgs.txt
download_svgs_cmd = [
'python', os.path.join(SVG_TOOLS, 'svg_downloader.py'),
'--output_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))
+
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.target_dir)
+ create_asset(args.local_svgs_dir, args.target_dir)
if __name__ == '__main__':
« no previous file with comments | « no previous file | infra/bots/assets/svg/create_and_upload.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698