| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 '''Tool to determine inputs and outputs of a grit file. | 6 '''Tool to determine inputs and outputs of a grit file. |
| 7 ''' | 7 ''' |
| 8 | 8 |
| 9 import optparse | 9 import optparse |
| 10 import os | 10 import os |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 def PrintUsage(): | 76 def PrintUsage(): |
| 77 print 'USAGE: ./grit_info.py --inputs [-D foo] <grd-files>..' | 77 print 'USAGE: ./grit_info.py --inputs [-D foo] <grd-files>..' |
| 78 print ' ./grit_info.py --outputs [-D foo] <out-prefix> <grd-files>..' | 78 print ' ./grit_info.py --outputs [-D foo] <out-prefix> <grd-files>..' |
| 79 | 79 |
| 80 | 80 |
| 81 def main(argv): | 81 def main(argv): |
| 82 parser = optparse.OptionParser() | 82 parser = optparse.OptionParser() |
| 83 parser.add_option("--inputs", action="store_true", dest="inputs") | 83 parser.add_option("--inputs", action="store_true", dest="inputs") |
| 84 parser.add_option("--outputs", action="store_true", dest="outputs") | 84 parser.add_option("--outputs", action="store_true", dest="outputs") |
| 85 parser.add_option("-D", action="append", dest="defines", default=[]) | 85 parser.add_option("-D", action="append", dest="defines", default=[]) |
| 86 # grit build also supports '-E KEY=VALUE', support that to share command |
| 87 # line flags. |
| 88 parser.add_option("-E", action="append", dest="build_env", default=[]) |
| 86 | 89 |
| 87 options, args = parser.parse_args() | 90 options, args = parser.parse_args() |
| 88 | 91 |
| 89 if not len(args): | 92 if not len(args): |
| 90 PrintUsage() | 93 PrintUsage() |
| 91 return 1 | 94 return 1 |
| 92 | 95 |
| 93 defines = {} | 96 defines = {} |
| 94 for define in options.defines: | 97 for define in options.defines: |
| 95 defines[define] = 1 | 98 defines[define] = 1 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 109 outputs = [posixpath.join(args[0], f) for f in Outputs(f, defines)] | 112 outputs = [posixpath.join(args[0], f) for f in Outputs(f, defines)] |
| 110 print '\n'.join(outputs) | 113 print '\n'.join(outputs) |
| 111 else: | 114 else: |
| 112 PrintUsage() | 115 PrintUsage() |
| 113 return 1 | 116 return 1 |
| 114 return 0 | 117 return 0 |
| 115 | 118 |
| 116 | 119 |
| 117 if __name__ == '__main__': | 120 if __name__ == '__main__': |
| 118 sys.exit(main(sys.argv)) | 121 sys.exit(main(sys.argv)) |
| OLD | NEW |