OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 The Chromium Authors. All rights reserved. | 2 # Copyright 2013 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 import os | 6 import os |
7 import re | 7 import re |
8 import sys | 8 import sys |
9 | 9 |
10 import json | 10 import json |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 ProcessFile(output_set, include_file, directories) | 59 ProcessFile(output_set, include_file, directories) |
60 | 60 |
61 | 61 |
62 def DoMain(argv): | 62 def DoMain(argv): |
63 "Entry point for gyp's pymod_do_main command." | 63 "Entry point for gyp's pymod_do_main command." |
64 parser = optparse.OptionParser() | 64 parser = optparse.OptionParser() |
65 # Give a clearer error message when this is used as a module. | 65 # Give a clearer error message when this is used as a module. |
66 parser.prog = 'liblouis_list_tables' | 66 parser.prog = 'liblouis_list_tables' |
67 parser.set_usage('usage: %prog [options] listfile') | 67 parser.set_usage('usage: %prog [options] listfile') |
68 parser.add_option('-D', '--directory', dest='directories', | 68 parser.add_option('-D', '--directory', dest='directories', |
69 action='append', help='Where to search for table files') | 69 action='append', help='Where to search for table files') |
| 70 parser.add_option('-e', '--extra_file', dest='extra_files', action='append', |
| 71 default=[], help='Extra liblouis table file to process') |
70 (options, args) = parser.parse_args(argv) | 72 (options, args) = parser.parse_args(argv) |
71 | 73 |
72 if len(args) != 1: | 74 if len(args) != 1: |
73 parser.error('Expecting exactly one argument') | 75 parser.error('Expecting exactly one argument') |
74 if not options.directories: | 76 if not options.directories: |
75 parser.error('At least one --directory option must be specified') | 77 parser.error('At least one --directory option must be specified') |
76 | 78 |
77 tables = LoadTablesFile(args[0]) | 79 tables = LoadTablesFile(args[0]) |
78 output_set = set() | 80 output_set = set() |
79 for table in tables: | 81 for table in tables: |
80 ProcessFile(output_set, table['fileName'], options.directories) | 82 for name in table['fileNames'].split(','): |
| 83 ProcessFile(output_set, name, options.directories) |
| 84 for name in options.extra_files: |
| 85 ProcessFile(output_set, name, options.directories) |
81 return '\n'.join(output_set) | 86 return '\n'.join(output_set) |
82 | 87 |
83 | 88 |
84 def main(argv): | 89 def main(argv): |
85 print DoMain(argv[1:]) | 90 print DoMain(argv[1:]) |
86 | 91 |
87 | 92 |
88 if __name__ == '__main__': | 93 if __name__ == '__main__': |
89 try: | 94 try: |
90 sys.exit(main(sys.argv)) | 95 sys.exit(main(sys.argv)) |
91 except KeyboardInterrupt: | 96 except KeyboardInterrupt: |
92 Error('interrupted') | 97 Error('interrupted') |
OLD | NEW |