OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright 2014 The Chromium Authors. All rights reserved. | 3 # Copyright 2014 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 import collections | 7 import collections |
8 from datetime import date | 8 from datetime import date |
9 import re | 9 import re |
10 import optparse | 10 import optparse |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
222 self._multi_line_generator_directive = (directive_name, [directive_value]) | 222 self._multi_line_generator_directive = (directive_name, [directive_value]) |
223 elif enum_start: | 223 elif enum_start: |
224 if self._generator_directives.empty: | 224 if self._generator_directives.empty: |
225 return | 225 return |
226 self._current_definition = EnumDefinition( | 226 self._current_definition = EnumDefinition( |
227 original_enum_name=enum_start.groups()[1], | 227 original_enum_name=enum_start.groups()[1], |
228 fixed_type=enum_start.groups()[3]) | 228 fixed_type=enum_start.groups()[3]) |
229 self._in_enum = True | 229 self._in_enum = True |
230 | 230 |
231 def GetScriptName(): | 231 def GetScriptName(): |
232 script_components = os.path.abspath(sys.argv[0]).split(os.path.sep) | 232 return os.path.basename(os.path.abspath(sys.argv[0])) |
kjellander_chromium
2016/01/11 09:19:55
This returns the same result as before for Chromiu
| |
233 build_index = script_components.index('build') | |
234 return os.sep.join(script_components[build_index:]) | |
235 | |
236 | 233 |
237 def DoGenerate(source_paths): | 234 def DoGenerate(source_paths): |
238 for source_path in source_paths: | 235 for source_path in source_paths: |
239 enum_definitions = DoParseHeaderFile(source_path) | 236 enum_definitions = DoParseHeaderFile(source_path) |
240 if not enum_definitions: | 237 if not enum_definitions: |
241 raise Exception('No enums found in %s\n' | 238 raise Exception('No enums found in %s\n' |
242 'Did you forget prefixing enums with ' | 239 'Did you forget prefixing enums with ' |
243 '"// GENERATED_JAVA_ENUM_PACKAGE: foo"?' % | 240 '"// GENERATED_JAVA_ENUM_PACKAGE: foo"?' % |
244 source_path) | 241 source_path) |
245 for enum_definition in enum_definitions: | 242 for enum_definition in enum_definitions: |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 if options.verbose: | 360 if options.verbose: |
364 print 'Output paths:' | 361 print 'Output paths:' |
365 print '\n'.join(output_paths) | 362 print '\n'.join(output_paths) |
366 | 363 |
367 # Used by GYP. | 364 # Used by GYP. |
368 return ' '.join(output_paths) | 365 return ' '.join(output_paths) |
369 | 366 |
370 | 367 |
371 if __name__ == '__main__': | 368 if __name__ == '__main__': |
372 DoMain(sys.argv[1:]) | 369 DoMain(sys.argv[1:]) |
OLD | NEW |