Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # | |
| 3 # Copyright 2016 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. | |
| 6 | |
| 7 """Creates a simple wrapper script that passes the correct --output-directory. | |
| 8 """ | |
| 9 | |
| 10 import argparse | |
| 11 import os | |
| 12 | |
| 13 _TEMPLATE = """\ | |
| 14 #!/usr/bin/env python | |
| 15 # | |
| 16 # This file was generated by //build/android/gyp/create_tool_script.py | |
|
watk
2016/02/09 01:06:59
Name is out of date.
| |
| 17 | |
| 18 import os | |
| 19 import sys | |
| 20 | |
| 21 args = ['--output-directory={output_directory}'] + sys.argv[1:] | |
| 22 os.execv('{cmd}', args) | |
| 23 """ | |
| 24 | |
| 25 def main(): | |
| 26 parser = argparse.ArgumentParser() | |
| 27 parser.add_argument('--output', help='Output path for executable script.') | |
| 28 parser.add_argument('--target', help='Path to script being wrapped.') | |
| 29 parser.add_argument('--output-directory', help='Value for --output-directory') | |
| 30 args = parser.parse_args() | |
| 31 | |
| 32 with open(args.output, 'w') as script: | |
| 33 script.write(_TEMPLATE.format( | |
| 34 cmd=os.path.abspath(args.target), | |
| 35 output_directory=os.path.abspath(args.output_directory))) | |
| 36 | |
| 37 os.chmod(args.output, 0750) | |
| 38 | |
| 39 | |
| 40 if __name__ == '__main__': | |
| 41 main() | |
| OLD | NEW |