diff options
Diffstat (limited to 'chromium/third_party/libvpx/copy_obj.py')
-rwxr-xr-x | chromium/third_party/libvpx/copy_obj.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/chromium/third_party/libvpx/copy_obj.py b/chromium/third_party/libvpx/copy_obj.py new file mode 100755 index 00000000000..5fd2173def0 --- /dev/null +++ b/chromium/third_party/libvpx/copy_obj.py @@ -0,0 +1,32 @@ +#!/usr/bin/python +# +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""This script is used to find and copy a file that may be found in one or more +places. The sources are searched in order and (only) the first one found will +be copied to the destination.""" + +import shutil +import optparse +import os +import sys + +parser = optparse.OptionParser() +parser.description = __doc__ +parser.add_option('-d', '--destination') +parser.add_option('-s', '--source', default=[], action='append', + help='Specify multiple times for multiple sources.') +options, args = parser.parse_args() +if (not options.destination or not options.source): + parser.error('Must specify both a destination and one or more sources.') + sys.exit(1) + +for src in options.source: + if os.path.exists(src): + shutil.copyfile(src, options.destination) + sys.exit(0) + +print "Unable to locate file" +sys.exit(1) |