diff options
author | 2016-07-18 10:36:43 -0700 | |
---|---|---|
committer | 2016-07-18 10:36:43 -0700 | |
commit | baaea531c249d3a13b0d04eca59b8bd0ee58d76b (patch) | |
tree | c84b17a34ee8433210a74bf3965c4d9eaa23b8c7 /infra | |
parent | 4ecb8ab556214c9337f56bc36d50e4d7c655ac7a (diff) |
Convert SK Images to new assets format
Depends on https://codereview.chromium.org/2162563002/
BUG=skia:5427
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2155163002
Review-Url: https://codereview.chromium.org/2155163002
Diffstat (limited to 'infra')
-rw-r--r-- | infra/bots/assets/skimage/VERSION | 1 | ||||
-rwxr-xr-x | infra/bots/assets/skimage/common.py | 26 | ||||
-rwxr-xr-x | infra/bots/assets/skimage/create.py | 38 | ||||
-rwxr-xr-x | infra/bots/assets/skimage/create_and_upload.py | 42 | ||||
-rwxr-xr-x | infra/bots/assets/skimage/download.py | 16 | ||||
-rwxr-xr-x | infra/bots/assets/skimage/upload.py | 16 | ||||
-rw-r--r-- | infra/bots/common.py | 2 | ||||
-rw-r--r-- | infra/bots/download_images.py | 28 | ||||
-rw-r--r-- | infra/bots/images.isolate | 8 | ||||
-rw-r--r-- | infra/bots/perf_skia.isolate | 1 | ||||
-rw-r--r-- | infra/bots/test_skia.isolate | 1 |
11 files changed, 139 insertions, 40 deletions
diff --git a/infra/bots/assets/skimage/VERSION b/infra/bots/assets/skimage/VERSION new file mode 100644 index 0000000000..c227083464 --- /dev/null +++ b/infra/bots/assets/skimage/VERSION @@ -0,0 +1 @@ +0
\ No newline at end of file diff --git a/infra/bots/assets/skimage/common.py b/infra/bots/assets/skimage/common.py new file mode 100755 index 0000000000..4920c9b4fb --- /dev/null +++ b/infra/bots/assets/skimage/common.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Common vars used by scripts in this directory.""" + + +import os +import sys + +FILE_DIR = os.path.dirname(os.path.abspath(__file__)) +INFRA_BOTS_DIR = os.path.realpath(os.path.join(FILE_DIR, os.pardir, os.pardir)) + +sys.path.insert(0, INFRA_BOTS_DIR) +from assets import assets + +ASSET_NAME = os.path.basename(FILE_DIR) + + +def run(cmd): + """Run a command, eg. "upload" or "download". """ + assets.main([cmd, ASSET_NAME] + sys.argv[1:]) diff --git a/infra/bots/assets/skimage/create.py b/infra/bots/assets/skimage/create.py new file mode 100755 index 0000000000..bb83fef3f1 --- /dev/null +++ b/infra/bots/assets/skimage/create.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset.""" + + +import argparse +import common +from assets import asset_utils + + +def create_asset(target_dir): + """Create the asset.""" + # The common case is to add one or more images to the existing set. Therefore, + # download the previous version first. + asset = asset_utils.Asset(common.ASSET_NAME, asset_utils.MultiStore()) + asset.download_current_version(target_dir) + + # Allow the user to modify the contents of the target dir. + raw_input('Previous SKImage contents have been downloaded. Please make ' + 'your desired changes in the following directory and press enter ' + 'to continue:\n%s' % target_dir) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--target_dir', '-t', required=True) + args = parser.parse_args() + create_asset(args.target_dir) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/skimage/create_and_upload.py b/infra/bots/assets/skimage/create_and_upload.py new file mode 100755 index 0000000000..1356447477 --- /dev/null +++ b/infra/bots/assets/skimage/create_and_upload.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Create the asset and upload it.""" + + +import argparse +import common +import os +import subprocess +import sys +import utils + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--gsutil') + args = parser.parse_args() + + with utils.tmp_dir(): + cwd = os.getcwd() + create_script = os.path.join(common.FILE_DIR, 'create.py') + upload_script = os.path.join(common.FILE_DIR, 'upload.py') + + try: + subprocess.check_call(['python', create_script, '-t', cwd]) + cmd = ['python', upload_script, '-t', cwd] + if args.gsutil: + cmd.extend(['--gsutil', args.gsutil]) + subprocess.check_call(cmd) + except subprocess.CalledProcessError: + # Trap exceptions to avoid printing two stacktraces. + sys.exit(1) + + +if __name__ == '__main__': + main() diff --git a/infra/bots/assets/skimage/download.py b/infra/bots/assets/skimage/download.py new file mode 100755 index 0000000000..96cc87d43f --- /dev/null +++ b/infra/bots/assets/skimage/download.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Download the current version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('download') diff --git a/infra/bots/assets/skimage/upload.py b/infra/bots/assets/skimage/upload.py new file mode 100755 index 0000000000..ba7fc8b6a1 --- /dev/null +++ b/infra/bots/assets/skimage/upload.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +# +# Copyright 2016 Google Inc. +# +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + + +"""Upload a new version of the asset.""" + + +import common + + +if __name__ == '__main__': + common.run('upload') diff --git a/infra/bots/common.py b/infra/bots/common.py index e4314dd78f..3c4a85d163 100644 --- a/infra/bots/common.py +++ b/infra/bots/common.py @@ -13,10 +13,8 @@ import subprocess GS_GM_BUCKET = 'chromium-skia-gm' -GS_SUBDIR_TMPL_SK_IMAGE = 'skimage/v%s' GS_SUBDIR_TMPL_SKP = 'playback_%s/skps' -VERSION_FILE_SK_IMAGE = 'SK_IMAGE_VERSION' VERSION_FILE_SKP = 'SKP_VERSION' diff --git a/infra/bots/download_images.py b/infra/bots/download_images.py deleted file mode 100644 index 4342a9f1a6..0000000000 --- a/infra/bots/download_images.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2016 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - - -import common -import os -import sys - - -def main(): - if len(sys.argv) != 1: - print >> sys.stderr, 'Usage: download_images.py' - sys.exit(1) - skia_dir = os.path.abspath(os.path.join( - os.path.dirname(os.path.realpath(__file__)), - os.pardir, os.pardir)) - dst_dir = os.path.join(skia_dir, os.pardir, 'images') - tmp_dir = os.path.join(skia_dir, os.pardir, 'tmp') - common.download_dir(skia_dir, tmp_dir, common.VERSION_FILE_SK_IMAGE, - common.GS_SUBDIR_TMPL_SK_IMAGE, dst_dir) - - -if __name__ == '__main__': - main() diff --git a/infra/bots/images.isolate b/infra/bots/images.isolate deleted file mode 100644 index 573342b8e8..0000000000 --- a/infra/bots/images.isolate +++ /dev/null @@ -1,8 +0,0 @@ -{ - 'variables': { - 'files': [ - '../../../images/', - '../../../tmp/SK_IMAGE_VERSION', - ], - }, -} diff --git a/infra/bots/perf_skia.isolate b/infra/bots/perf_skia.isolate index d98741c07d..8e38791ebf 100644 --- a/infra/bots/perf_skia.isolate +++ b/infra/bots/perf_skia.isolate @@ -1,7 +1,6 @@ { 'includes': [ 'android_bin.isolate', - 'images.isolate', 'infrabots.isolate', 'ios_bin.isolate', 'resources.isolate', diff --git a/infra/bots/test_skia.isolate b/infra/bots/test_skia.isolate index d98741c07d..8e38791ebf 100644 --- a/infra/bots/test_skia.isolate +++ b/infra/bots/test_skia.isolate @@ -1,7 +1,6 @@ { 'includes': [ 'android_bin.isolate', - 'images.isolate', 'infrabots.isolate', 'ios_bin.isolate', 'resources.isolate', |