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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/compute_global_objects.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 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 """Compute global objects. 7 """Compute global objects.
8 8
9 Global objects are defined by interfaces with [Global] or [PrimaryGlobal] on 9 Global objects are defined by interfaces with [Global] or [PrimaryGlobal] on
10 their definition: http://heycam.github.io/webidl/#Global 10 their definition: http://heycam.github.io/webidl/#Global
(...skipping 11 matching lines...) Expand all
22 GLOBAL_EXTENDED_ATTRIBUTES = frozenset([ 22 GLOBAL_EXTENDED_ATTRIBUTES = frozenset([
23 'Global', 23 'Global',
24 'PrimaryGlobal', 24 'PrimaryGlobal',
25 ]) 25 ])
26 26
27 27
28 def parse_options(): 28 def parse_options():
29 usage = 'Usage: %prog [options] [GlobalObjectsComponent.pickle]... [GlobalOb jects.pickle]' 29 usage = 'Usage: %prog [options] [GlobalObjectsComponent.pickle]... [GlobalOb jects.pickle]'
30 parser = optparse.OptionParser(usage=usage) 30 parser = optparse.OptionParser(usage=usage)
31 parser.add_option('--idl-files-list', help='file listing IDL files') 31 parser.add_option('--idl-files-list', help='file listing IDL files')
32 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')
33 32
34 options, args = parser.parse_args() 33 options, args = parser.parse_args()
35 34
36 if options.idl_files_list is None: 35 if options.idl_files_list is None:
37 parser.error('Must specify a file listing IDL files using --idl-files-li st.') 36 parser.error('Must specify a file listing IDL files using --idl-files-li st.')
38 if options.write_file_only_if_changed is None:
39 parser.error('Must specify whether output files are only written if chan ged using --write-file-only-if-changed.')
40 options.write_file_only_if_changed = bool(options.write_file_only_if_changed )
41 if not args: 37 if not args:
42 parser.error('Must specify an output pickle filename as argument, ' 38 parser.error('Must specify an output pickle filename as argument, '
43 'optionally preceeded by input pickle filenames.') 39 'optionally preceeded by input pickle filenames.')
44 40
45 return options, args 41 return options, args
46 42
47 43
48 def dict_union(dicts): 44 def dict_union(dicts):
49 return dict((k, v) for d in dicts for k, v in d.iteritems()) 45 return dict((k, v) for d in dicts for k, v in d.iteritems())
50 46
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 existing_interface_name_global_names 92 existing_interface_name_global_names
97 for existing_interface_name_global_names in read_pickle_files(args)) 93 for existing_interface_name_global_names in read_pickle_files(args))
98 94
99 # Input IDL files are passed in a file, due to OS command line length 95 # Input IDL files are passed in a file, due to OS command line length
100 # limits. This is generated at GYP time, which is ok b/c files are static. 96 # limits. This is generated at GYP time, which is ok b/c files are static.
101 idl_files = read_file_to_list(options.idl_files_list) 97 idl_files = read_file_to_list(options.idl_files_list)
102 interface_name_global_names.update( 98 interface_name_global_names.update(
103 idl_files_to_interface_name_global_names(idl_files)) 99 idl_files_to_interface_name_global_names(idl_files))
104 100
105 write_pickle_file(output_global_objects_filename, 101 write_pickle_file(output_global_objects_filename,
106 interface_name_global_names, 102 interface_name_global_names)
107 options.write_file_only_if_changed)
108 103
109 104
110 if __name__ == '__main__': 105 if __name__ == '__main__':
111 sys.exit(main()) 106 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698