Chromium Code Reviews| Index: build/android/gyp/create_tool_wrapper.py |
| diff --git a/build/android/gyp/create_tool_wrapper.py b/build/android/gyp/create_tool_wrapper.py |
| new file mode 100755 |
| index 0000000000000000000000000000000000000000..2f0bc659668691e9e6125d44bd20b10e06c98fbf |
| --- /dev/null |
| +++ b/build/android/gyp/create_tool_wrapper.py |
| @@ -0,0 +1,41 @@ |
| +#!/usr/bin/env python |
| +# |
| +# Copyright 2016 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. |
| + |
| +"""Creates a simple wrapper script that passes the correct --output-directory. |
| +""" |
| + |
| +import argparse |
| +import os |
| + |
| +_TEMPLATE = """\ |
| +#!/usr/bin/env python |
| +# |
| +# This file was generated by //build/android/gyp/create_tool_script.py |
|
watk
2016/02/09 01:06:59
Name is out of date.
|
| + |
| +import os |
| +import sys |
| + |
| +args = ['--output-directory={output_directory}'] + sys.argv[1:] |
| +os.execv('{cmd}', args) |
| +""" |
| + |
| +def main(): |
| + parser = argparse.ArgumentParser() |
| + parser.add_argument('--output', help='Output path for executable script.') |
| + parser.add_argument('--target', help='Path to script being wrapped.') |
| + parser.add_argument('--output-directory', help='Value for --output-directory') |
| + args = parser.parse_args() |
| + |
| + with open(args.output, 'w') as script: |
| + script.write(_TEMPLATE.format( |
| + cmd=os.path.abspath(args.target), |
| + output_directory=os.path.abspath(args.output_directory))) |
| + |
| + os.chmod(args.output, 0750) |
| + |
| + |
| +if __name__ == '__main__': |
| + main() |