Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(407)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py

Issue 2367303002: [Bindings] Remove a redundant option write-file-if-only-changed in bindings (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # 2 #
3 # Copyright (C) 2013 Google Inc. All rights reserved. 3 # Copyright (C) 2013 Google Inc. All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 pass 68 pass
69 69
70 70
71 def parse_options(): 71 def parse_options():
72 usage = 'Usage: %prog [options]' 72 usage = 'Usage: %prog [options]'
73 parser = optparse.OptionParser(usage=usage) 73 parser = optparse.OptionParser(usage=usage)
74 parser.add_option('--cache-directory', help='cache directory') 74 parser.add_option('--cache-directory', help='cache directory')
75 parser.add_option('--idl-files-list', help='file listing IDL files') 75 parser.add_option('--idl-files-list', help='file listing IDL files')
76 parser.add_option('--interfaces-info-file', help='interface info pickle file ') 76 parser.add_option('--interfaces-info-file', help='interface info pickle file ')
77 parser.add_option('--component-info-file', help='component wide info pickle file') 77 parser.add_option('--component-info-file', help='component wide info pickle file')
78 parser.add_option('--write-file-only-if-changed', type='int', help='if true, do not write an output file if it would be identical to the existing one, which avoids unnecessary rebuilds in ninja')
79 78
80 options, args = parser.parse_args() 79 options, args = parser.parse_args()
81 if options.interfaces_info_file is None: 80 if options.interfaces_info_file is None:
82 parser.error('Must specify an output file using --interfaces-info-file.' ) 81 parser.error('Must specify an output file using --interfaces-info-file.' )
83 if options.idl_files_list is None: 82 if options.idl_files_list is None:
84 parser.error('Must specify a file listing IDL files using --idl-files-li st.') 83 parser.error('Must specify a file listing IDL files using --idl-files-li st.')
85 if options.write_file_only_if_changed is None:
86 parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.')
87 options.write_file_only_if_changed = bool(options.write_file_only_if_changed )
88 return options, args 84 return options, args
89 85
90 86
91 ################################################################################ 87 ################################################################################
92 # Computations 88 # Computations
93 ################################################################################ 89 ################################################################################
94 90
95 def relative_dir_posix(idl_filename, base_path): 91 def relative_dir_posix(idl_filename, base_path):
96 """Returns relative path to the directory of idl_file in POSIX format.""" 92 """Returns relative path to the directory of idl_file in POSIX format."""
97 relative_path_local = os.path.relpath(idl_filename, base_path) 93 relative_path_local = os.path.relpath(idl_filename, base_path)
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 idl_files = read_idl_files_list_from_file(options.idl_files_list, is_gyp_for mat=False) 349 idl_files = read_idl_files_list_from_file(options.idl_files_list, is_gyp_for mat=False)
354 350
355 # Compute information for individual files 351 # Compute information for individual files
356 # Information is stored in global variables interfaces_info and 352 # Information is stored in global variables interfaces_info and
357 # partial_interface_files. 353 # partial_interface_files.
358 info_collector = InterfaceInfoCollector(options.cache_directory) 354 info_collector = InterfaceInfoCollector(options.cache_directory)
359 for idl_filename in idl_files: 355 for idl_filename in idl_files:
360 info_collector.collect_info(idl_filename) 356 info_collector.collect_info(idl_filename)
361 357
362 write_pickle_file(options.interfaces_info_file, 358 write_pickle_file(options.interfaces_info_file,
363 info_collector.get_info_as_dict(), 359 info_collector.get_info_as_dict())
364 options.write_file_only_if_changed)
365 write_pickle_file(options.component_info_file, 360 write_pickle_file(options.component_info_file,
366 info_collector.get_component_info_as_dict(), 361 info_collector.get_component_info_as_dict())
367 options.write_file_only_if_changed)
368 362
369 if __name__ == '__main__': 363 if __name__ == '__main__':
370 sys.exit(main()) 364 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698