| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 import v8_callback_interface | 79 import v8_callback_interface |
| 80 import v8_dictionary | 80 import v8_dictionary |
| 81 from v8_globals import includes, interfaces | 81 from v8_globals import includes, interfaces |
| 82 import v8_interface | 82 import v8_interface |
| 83 from v8_methods import method_filters | 83 from v8_methods import method_filters |
| 84 import v8_types | 84 import v8_types |
| 85 import v8_union | 85 import v8_union |
| 86 from v8_utilities import capitalize, cpp_name, for_origin_trial_feature, unique_
by | 86 from v8_utilities import capitalize, cpp_name, for_origin_trial_feature, unique_
by |
| 87 from utilities import ( | 87 from utilities import ( |
| 88 idl_filename_to_component, is_valid_component_dependency, is_testing_target, | 88 idl_filename_to_component, is_valid_component_dependency, is_testing_target, |
| 89 shorten_union_name, format_blink_cpp_source_code) | 89 shorten_union_name, format_remove_duplicates, format_blink_cpp_source_code) |
| 90 | 90 |
| 91 | 91 |
| 92 def normalize_and_sort_includes(include_paths): | 92 def normalize_and_sort_includes(include_paths): |
| 93 normalized_include_paths = [] | 93 normalized_include_paths = [] |
| 94 for include_path in include_paths: | 94 for include_path in include_paths: |
| 95 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path)) | 95 match = re.search(r'/gen/blink/(.*)$', posixpath.abspath(include_path)) |
| 96 if match: | 96 if match: |
| 97 include_path = match.group(1) | 97 include_path = match.group(1) |
| 98 normalized_include_paths.append(include_path) | 98 normalized_include_paths.append(include_path) |
| 99 return sorted(normalized_include_paths) | 99 return sorted(normalized_include_paths) |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 # if pre-cached this is read-only, but writing creates a race condition. | 423 # if pre-cached this is read-only, but writing creates a race condition. |
| 424 bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), | 424 bytecode_cache=jinja2.FileSystemBytecodeCache(cache_dir), |
| 425 keep_trailing_newline=True, # newline-terminate generated files | 425 keep_trailing_newline=True, # newline-terminate generated files |
| 426 lstrip_blocks=True, # so can indent control flow tags | 426 lstrip_blocks=True, # so can indent control flow tags |
| 427 trim_blocks=True) | 427 trim_blocks=True) |
| 428 jinja_env.filters.update({ | 428 jinja_env.filters.update({ |
| 429 'blink_capitalize': capitalize, | 429 'blink_capitalize': capitalize, |
| 430 'exposed': exposed_if, | 430 'exposed': exposed_if, |
| 431 'for_origin_trial_feature': for_origin_trial_feature, | 431 'for_origin_trial_feature': for_origin_trial_feature, |
| 432 'format_blink_cpp_source_code': format_blink_cpp_source_code, | 432 'format_blink_cpp_source_code': format_blink_cpp_source_code, |
| 433 'format_remove_duplicates': format_remove_duplicates, |
| 433 'runtime_enabled': runtime_enabled_if, | 434 'runtime_enabled': runtime_enabled_if, |
| 434 'secure_context': secure_context_if, | 435 'secure_context': secure_context_if, |
| 435 'unique_by': unique_by, | 436 'unique_by': unique_by, |
| 436 }) | 437 }) |
| 437 jinja_env.filters.update(attribute_filters()) | 438 jinja_env.filters.update(attribute_filters()) |
| 438 jinja_env.filters.update(v8_interface.constant_filters()) | 439 jinja_env.filters.update(v8_interface.constant_filters()) |
| 439 jinja_env.filters.update(method_filters()) | 440 jinja_env.filters.update(method_filters()) |
| 440 return jinja_env | 441 return jinja_env |
| 441 | 442 |
| 442 | 443 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 | 491 |
| 491 # Create a dummy file as output for the build system, | 492 # Create a dummy file as output for the build system, |
| 492 # since filenames of individual cache files are unpredictable and opaque | 493 # since filenames of individual cache files are unpredictable and opaque |
| 493 # (they are hashes of the template path, which varies based on environment) | 494 # (they are hashes of the template path, which varies based on environment) |
| 494 with open(dummy_filename, 'w') as dummy_file: | 495 with open(dummy_filename, 'w') as dummy_file: |
| 495 pass # |open| creates or touches the file | 496 pass # |open| creates or touches the file |
| 496 | 497 |
| 497 | 498 |
| 498 if __name__ == '__main__': | 499 if __name__ == '__main__': |
| 499 sys.exit(main(sys.argv)) | 500 sys.exit(main(sys.argv)) |
| OLD | NEW |