Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: build/android/gyp/create_tool_wrapper.py

Issue 1663103004: Create wrapper scripts that set --output-directory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@adb_gdb-explicit
Patch Set: todo + adb_gdb Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « build/android/BUILD.gn ('k') | build/config/android/rules.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
17
18 import os
19 import sys
20
21 cmd = '{cmd}'
22 args = [os.path.basename(cmd), '{flag_name}={output_directory}'] + sys.argv[1:]
23 os.execv(cmd, args)
24 """
25
26 def main():
27 parser = argparse.ArgumentParser()
28 parser.add_argument('--output', help='Output path for executable script.')
29 parser.add_argument('--target', help='Path to script being wrapped.')
30 parser.add_argument('--output-directory', help='Value for --output-directory')
31 parser.add_argument('--flag-name',
32 help='Flag name to use instead of --output-directory',
33 default='--output-directory')
34 args = parser.parse_args()
35
36 with open(args.output, 'w') as script:
37 script.write(_TEMPLATE.format(
38 cmd=os.path.abspath(args.target),
39 flag_name=args.flag_name,
40 output_directory=os.path.abspath(args.output_directory)))
41
42 os.chmod(args.output, 0750)
43
44
45 if __name__ == '__main__':
46 main()
OLDNEW
« no previous file with comments | « build/android/BUILD.gn ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698