| Index: telemetry/third_party/cv2/roll_cv2
|
| diff --git a/telemetry/third_party/cv2/roll_cv2 b/telemetry/third_party/cv2/roll_cv2
|
| index 8e49b3513f74fd444a498bf5fccb206495346aee..1f498b0701f6046ae02d7c8d969e7425ddfa56ef 100755
|
| --- a/telemetry/third_party/cv2/roll_cv2
|
| +++ b/telemetry/third_party/cv2/roll_cv2
|
| @@ -4,10 +4,23 @@
|
| # found in the LICENSE file.
|
| #
|
| # Script to download, package, update, and upload OpenCV (cv2).
|
| +#
|
| +# Note: This has not been tested on Windows. The Windows cv2 binary in
|
| +# Cloud Storage was created manually by the following process:
|
| +# * Download
|
| +# https://github.com/opencv/opencv/releases/download/2.4.13.2/opencv-2.4.13.2-vc14.exe
|
| +# * Open using 7-Zip (or just run the exe)
|
| +# * Extract opencv/build/python/2.7/x64/cv2.pyd
|
| +# * Create a zip file containing only cv2.pyd
|
| +# * Rename cv2.zip to cv2_$(sha1sum cv2.zip)
|
| +# * Upload to cloud storage at chromium-telemetry/binary_dependencies
|
| +# * Add entry including hash and version number to cv2 win_AMD64 entry
|
| +# in binary_dependencies.json
|
|
|
| DESCRIPTION = '''\
|
| Downloads + builds OpenCV (cv2), packages it as a zip, and updates \
|
| -binary_dependencies.json and Cloud Storage with the result.'''
|
| +binary_dependencies.json and Cloud Storage with the result. (NOTE: \
|
| +Not tested on Windows. See comments for details.)'''
|
|
|
| import argparse
|
| import contextlib
|
| @@ -43,6 +56,9 @@ NUMPY_PATH = NUMPY_PATH[0]
|
| # insert rather than append to make sure we don't get system numpy.
|
| sys.path.insert(1, NUMPY_PATH)
|
|
|
| +class RollError(Exception):
|
| + pass
|
| +
|
| # Dependency update helper
|
| def update_dependency(dependency, path, version):
|
| config = os.path.join(CATAPULT_ROOT, 'telemetry', 'telemetry', 'internal',
|
| @@ -53,11 +69,26 @@ def update_dependency(dependency, path, version):
|
| platform = "{}_{}".format(os_name, arch_name)
|
|
|
| c = base_config.BaseConfig(config, writable=True)
|
| - c.AddCloudStorageDependencyUpdateJob(
|
| - dependency, platform, path, version=version, execute_job=True)
|
| + try:
|
| + old_version = c.GetVersion(dependency, platform)
|
| + print 'Updating from version: {}'.format(old_version)
|
| + except ValueError:
|
| + raise RollError(
|
| + ('binary_dependencies.json entry for {} missing or invalid; please add '
|
| + 'it first! (need download_path and path_within_archive)')
|
| + .format(platform))
|
| +
|
| + if path:
|
| + c.AddCloudStorageDependencyUpdateJob(
|
| + dependency, platform, path, version=version, execute_job=True)
|
| +
|
| +def verify_dependency_entry(dependency):
|
| + update_dependency(dependency, None, None)
|
|
|
| # Main
|
| def main(version):
|
| + verify_dependency_entry('cv2')
|
| +
|
| outdir = os.path.join(SCRIPT_DIR, 'lib')
|
| if os.path.exists(outdir):
|
| shutil.rmtree(outdir)
|
| @@ -95,7 +126,7 @@ def main(version):
|
| print 'Zipping result...'
|
| root_dir = glob.glob(os.path.join('lib', 'python2.*', '*-packages'))
|
| if len(root_dir) != 1:
|
| - raise Exception(
|
| + raise RollError(
|
| 'Expected one glob match, found {}'.format(len(root_dir)))
|
| root_dir = root_dir[0]
|
| zip_result = shutil.make_archive(
|
| @@ -106,7 +137,7 @@ def main(version):
|
| print 'Uploading zip...'
|
| update_dependency('cv2', zip_result, version)
|
|
|
| - print '''\
|
| + print '''\
|
| Don't forget to run:
|
| $ GYP_DEFINES=fetch_telemetry_dependencies=1 \
|
| bin/fetch_telemetry_binary_dependencies
|
| @@ -126,6 +157,6 @@ if __name__ == '__main__':
|
|
|
| os.chdir(SCRIPT_DIR)
|
| main(args.version)
|
| - except Exception as e:
|
| + except RollError as e:
|
| print '{}: {}'.format(type(e).__name__, e.message)
|
| sys.exit(1)
|
|
|