OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 target.append(path) | 50 target.append(path) |
51 | 51 |
52 return [t.replace('\\', '/') for t in target] | 52 return [t.replace('\\', '/') for t in target] |
53 | 53 |
54 | 54 |
55 def GritSourceFiles(): | 55 def GritSourceFiles(): |
56 files = [] | 56 files = [] |
57 grit_root_dir = os.path.relpath(os.path.dirname(__file__), os.getcwd()) | 57 grit_root_dir = os.path.relpath(os.path.dirname(__file__), os.getcwd()) |
58 for root, dirs, filenames in os.walk(grit_root_dir): | 58 for root, dirs, filenames in os.walk(grit_root_dir): |
59 grit_src = [os.path.join(root, f) for f in filenames | 59 grit_src = [os.path.join(root, f) for f in filenames |
60 if f.endswith('.py')] | 60 if f.endswith('.py') and not f.endswith('_unittest.py')] |
61 files.extend(grit_src) | 61 files.extend(grit_src) |
62 return sorted(files) | 62 return sorted(files) |
63 | 63 |
64 | 64 |
65 def Inputs(filename, defines, ids_file, target_platform=None): | 65 def Inputs(filename, defines, ids_file, target_platform=None): |
66 grd = grd_reader.Parse( | 66 grd = grd_reader.Parse( |
67 filename, debug=False, defines=defines, tags_to_ignore=set(['message']), | 67 filename, debug=False, defines=defines, tags_to_ignore=set(['message']), |
68 first_ids_file=ids_file, target_platform=target_platform) | 68 first_ids_file=ids_file, target_platform=target_platform) |
69 files = set() | 69 files = set() |
70 for lang, ctx in grd.GetConfigurations(): | 70 for lang, ctx in grd.GetConfigurations(): |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 except WrongNumberOfArguments, e: | 172 except WrongNumberOfArguments, e: |
173 PrintUsage() | 173 PrintUsage() |
174 print e | 174 print e |
175 return 1 | 175 return 1 |
176 print result | 176 print result |
177 return 0 | 177 return 0 |
178 | 178 |
179 | 179 |
180 if __name__ == '__main__': | 180 if __name__ == '__main__': |
181 sys.exit(main(sys.argv)) | 181 sys.exit(main(sys.argv)) |
OLD | NEW |