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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_overall.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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 106
107 107
108 class IdlInterfaceFileNotFoundError(Exception): 108 class IdlInterfaceFileNotFoundError(Exception):
109 """Raised if the IDL file implementing an interface cannot be found.""" 109 """Raised if the IDL file implementing an interface cannot be found."""
110 pass 110 pass
111 111
112 112
113 def parse_options(): 113 def parse_options():
114 usage = 'Usage: %prog [InfoIndividual.pickle]... [Info.pickle]' 114 usage = 'Usage: %prog [InfoIndividual.pickle]... [Info.pickle]'
115 parser = optparse.OptionParser(usage=usage) 115 parser = optparse.OptionParser(usage=usage)
116 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')
117 116
118 options, args = parser.parse_args() 117 return parser.parse_args()
119 if options.write_file_only_if_changed is None:
120 parser.error('Must specify whether file is only written if changed using --write-file-only-if-changed.')
121 options.write_file_only_if_changed = bool(options.write_file_only_if_changed )
122 return options, args
123 118
124 119
125 def dict_of_dicts_of_lists_update_or_append(existing, other): 120 def dict_of_dicts_of_lists_update_or_append(existing, other):
126 """Updates an existing dict of dicts of lists, or appends to lists if key al ready present. 121 """Updates an existing dict of dicts of lists, or appends to lists if key al ready present.
127 122
128 Needed for merging partial_interface_files across components. 123 Needed for merging partial_interface_files across components.
129 """ 124 """
130 for key, value in other.iteritems(): 125 for key, value in other.iteritems():
131 if key not in existing: 126 if key not in existing:
132 existing[key] = value 127 existing[key] = value
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 del interface_info['is_legacy_treat_as_partial_interface'] 303 del interface_info['is_legacy_treat_as_partial_interface']
309 304
310 # Compute global_type_info to interfaces_info so that idl_compiler does 305 # Compute global_type_info to interfaces_info so that idl_compiler does
311 # not need to always calculate the info in __init__. 306 # not need to always calculate the info in __init__.
312 compute_global_type_info() 307 compute_global_type_info()
313 308
314 309
315 ################################################################################ 310 ################################################################################
316 311
317 def main(): 312 def main():
318 options, args = parse_options() 313 _, args = parse_options()
319 # args = Input1, Input2, ..., Output 314 # args = Input1, Input2, ..., Output
320 interfaces_info_filename = args.pop() 315 interfaces_info_filename = args.pop()
321 info_individuals = read_pickle_files(args) 316 info_individuals = read_pickle_files(args)
322 317
323 compute_interfaces_info_overall(info_individuals) 318 compute_interfaces_info_overall(info_individuals)
324 write_pickle_file(interfaces_info_filename, 319 write_pickle_file(interfaces_info_filename, interfaces_info)
325 interfaces_info,
326 options.write_file_only_if_changed)
327 320
328 321
329 if __name__ == '__main__': 322 if __name__ == '__main__':
330 sys.exit(main()) 323 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698