Update Polymer and pull in iron-list
[chromium-blink-merge.git] / third_party / libvpx_new / run_perl.py
bloba81828eb2bd90d98abba94fdf5311e0842dcd543
1 #!/usr/bin/python
3 # Copyright 2014 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
7 "This script is used to run a perl script."
9 import optparse
10 import subprocess
11 import sys
13 parser = optparse.OptionParser()
14 parser.description = __doc__
15 parser.add_option('-s', '--script', help='path to a perl script.')
16 parser.add_option('-i', '--input', help='file passed to stdin.')
17 parser.add_option('-o', '--output', help='file saved from stdout.')
20 options, args = parser.parse_args()
21 if (not options.script or not options.input or not options.output):
22 parser.error('Must specify arguments for script, input and output.')
23 sys.exit(1)
25 with open(options.output, 'w') as fo, open(options.input, 'r') as fi:
26 subprocess.check_call(['perl', options.script], stdout=fo, stdin=fi)
28 sys.exit(0)