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

Unified Diff: bindings/scripts/compute_interfaces_info_individual.py

Issue 959933002: Move IDLs to 39 roll (Closed) Base URL: https://dart.googlecode.com/svn/third_party/WebCore
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « bindings/scripts/code_generator_v8.py ('k') | bindings/scripts/compute_interfaces_info_overall.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bindings/scripts/compute_interfaces_info_individual.py
diff --git a/bindings/scripts/compute_interfaces_info_individual.py b/bindings/scripts/compute_interfaces_info_individual.py
index d7b58e14352c10360c1ba40f4f5bf3ee0597ef82..58f6790e67601de6af82421e7b83d576c1fc582e 100755
--- a/bindings/scripts/compute_interfaces_info_individual.py
+++ b/bindings/scripts/compute_interfaces_info_individual.py
@@ -47,7 +47,7 @@ import os
import posixpath
import sys
-from utilities import get_file_contents, read_file_to_list, idl_filename_to_interface_name, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, is_dictionary_from_idl, get_partial_interface_name_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl
+from utilities import get_file_contents, read_file_to_list, idl_filename_to_interface_name, idl_filename_to_component, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, is_dictionary_from_idl, get_partial_interface_name_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl
module_path = os.path.dirname(__file__)
source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir))
@@ -63,14 +63,11 @@ partial_interface_files = defaultdict(lambda: {
def parse_options():
usage = 'Usage: %prog [options] [generated1.idl]...'
parser = optparse.OptionParser(usage=usage)
- parser.add_option('--component-dir', help='component directory')
parser.add_option('--idl-files-list', help='file listing IDL files')
parser.add_option('--interfaces-info-file', help='output pickle file')
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')
options, args = parser.parse_args()
- if options.component_dir is None:
- parser.error('Must specify a component directory using --component-dir.')
if options.interfaces_info_file is None:
parser.error('Must specify an output file using --interfaces-info-file.')
if options.idl_files_list is None:
@@ -85,21 +82,26 @@ def parse_options():
# Computations
################################################################################
+def relative_dir_posix(idl_filename):
+ """Returns relative path to the directory of idl_file in POSIX format."""
+ relative_path_local = os.path.relpath(idl_filename, source_path)
+ relative_dir_local = os.path.dirname(relative_path_local)
+ return relative_dir_local.replace(os.path.sep, posixpath.sep)
+
+
def include_path(idl_filename, implemented_as=None):
"""Returns relative path to header file in POSIX format; used in includes.
POSIX format is used for consistency of output, so reference tests are
platform-independent.
"""
- relative_path_local = os.path.relpath(idl_filename, source_path)
- relative_dir_local = os.path.dirname(relative_path_local)
- relative_dir_posix = relative_dir_local.replace(os.path.sep, posixpath.sep)
+ relative_dir = relative_dir_posix(idl_filename)
# IDL file basename is used even if only a partial interface file
idl_file_basename, _ = os.path.splitext(os.path.basename(idl_filename))
cpp_class_name = implemented_as or idl_file_basename
- return posixpath.join(relative_dir_posix, cpp_class_name + '.h')
+ return posixpath.join(relative_dir, cpp_class_name + '.h')
def add_paths_to_partials_dict(partial_interface_name, full_path, this_include_path=None):
@@ -109,13 +111,14 @@ def add_paths_to_partials_dict(partial_interface_name, full_path, this_include_p
paths_dict['include_paths'].append(this_include_path)
-def compute_info_individual(idl_filename, component_dir):
+def compute_info_individual(idl_filename):
full_path = os.path.realpath(idl_filename)
idl_file_contents = get_file_contents(full_path)
extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)
implemented_as = extended_attributes.get('ImplementedAs')
- this_include_path = include_path(idl_filename, implemented_as)
+ relative_dir = relative_dir_posix(idl_filename)
+ this_include_path = None if 'NoImplHeader' in extended_attributes else include_path(idl_filename, implemented_as)
# Handle partial interfaces
partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents)
@@ -133,7 +136,6 @@ def compute_info_individual(idl_filename, component_dir):
left_interfaces, right_interfaces = get_implements_from_idl(idl_file_contents, interface_name)
interfaces_info[interface_name] = {
- 'component_dir': component_dir,
'extended_attributes': extended_attributes,
'full_path': full_path,
'implemented_as': implemented_as,
@@ -153,6 +155,7 @@ def compute_info_individual(idl_filename, component_dir):
# These cause rebuilds of referrers, due to the dependency, so these
# should be minimized; currently only targets of [PutForwards].
'referenced_interfaces': get_put_forward_interfaces_from_idl(idl_file_contents),
+ 'relative_dir': relative_dir,
}
@@ -182,7 +185,7 @@ def main():
# Information is stored in global variables interfaces_info and
# partial_interface_files.
for idl_filename in idl_files:
- compute_info_individual(idl_filename, options.component_dir)
+ compute_info_individual(idl_filename)
write_pickle_file(options.interfaces_info_file,
info_individual(),
« no previous file with comments | « bindings/scripts/code_generator_v8.py ('k') | bindings/scripts/compute_interfaces_info_overall.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698