OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/python | |
sashab
2016/07/08 00:58:26
Just rename this to ninja_options_script.py and de
jkarlin
2016/07/18 17:48:55
Done. Note that the parameters are different, so t
| |
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 # Usage within SublimeClang: | |
8 # "sublimeclang_options_script": "python | |
9 # ${project_path}/src/tools/sublime/compile_flags.py \ | |
10 # -d '${project_path}/../depot_tools'" | |
sashab
2016/07/08 00:58:27
-d '/path/to/depot_tools'
sashab
2016/07/08 00:58:27
-d '/path/to/depot_tools'
jkarlin
2016/07/18 17:48:55
Done.
| |
11 # | |
12 # | |
13 # NOTE: ${project_path} expands to the directory of the Sublime project file, | |
14 # and SublimgClang passes the absolute file path to the current file as an | |
sashab
2016/07/08 00:58:26
SublimeClang*
jkarlin
2016/07/18 17:48:55
Done.
| |
15 # additional argument. You should change the -d argument to point to your | |
16 # depot_tools directory. | |
17 | |
18 import imp | |
19 import optparse | |
20 import os | |
21 import sys | |
22 | |
23 ycm_module_path = os.path.normpath( | |
24 os.path.join(os.path.dirname(os.path.abspath(__file__)), | |
25 '../vim/chromium.ycm_extra_conf.py')) | |
26 ycm_extra_conf = imp.load_source('ycm_extra_conf', ycm_module_path) | |
27 | |
28 def main(): | |
29 usage = "usage: %prog [options] file" | |
30 parser = optparse.OptionParser(usage) | |
31 parser.add_option("-d", "--depot_tools", dest="depot_path", | |
32 help="path to depot_tools") | |
33 (options, args) = parser.parse_args() | |
34 if options.depot_path: | |
35 os.environ["PATH"] += ":%s" % options.depot_path | |
36 if len(args) != 1: | |
37 parser.error("incorrect number of arguments") | |
38 | |
39 path = os.path.realpath(args[0]) | |
40 results = ycm_extra_conf.FlagsForFile(path) | |
41 | |
42 for flag in results['flags']: | |
43 print flag | |
44 | |
45 if __name__ == "__main__": | |
46 main() | |
OLD | NEW |