Chromium Code Reviews| Index: Source/bindings/scripts/compute_interfaces_info_individual.py |
| diff --git a/Source/bindings/scripts/compute_interfaces_info_individual.py b/Source/bindings/scripts/compute_interfaces_info_individual.py |
| index c3671d9ebdf8ff735dd54aab530404b00382de01..8d975b28f4da3fbf93b3d18c7f53ee1fc3005b59 100755 |
| --- a/Source/bindings/scripts/compute_interfaces_info_individual.py |
| +++ b/Source/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, 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, 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)) |
| @@ -85,21 +85,26 @@ def parse_options(): |
| # Computations |
| ################################################################################ |
| +def relative_dir_posix(idl_filename): |
| + """Returns relative path to the directory of idl_file in POSIX format.""" |
| + |
|
Nils Barth (inactive)
2014/07/18 21:52:34
nit: blank line
bashi
2014/07/22 02:33:57
Removed.
|
| + 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): |
| @@ -116,6 +121,7 @@ def compute_info_individual(idl_filename, component_dir): |
| 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) |
| # Handle partial interfaces |
| partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents) |
| @@ -144,6 +150,7 @@ def compute_info_individual(idl_filename, component_dir): |
| # 'implements': http://crbug.com/360435 |
| 'is_legacy_treat_as_partial_interface': 'LegacyTreatAsPartialInterface' in extended_attributes, |
|
Nils Barth (inactive)
2014/07/18 21:52:34
Could you fix the alpha here?
bashi
2014/07/22 02:33:57
Done.
|
| 'is_callback_interface': is_callback_interface_from_idl(idl_file_contents), |
| + 'is_dictionary': is_dictionary_from_idl(idl_file_contents), |
| 'parent': get_parent_interface(idl_file_contents), |
| # Interfaces that are referenced (used as types) and that we introspect |
| # during code generation (beyond interface-level data ([ImplementedAs], |
| @@ -152,6 +159,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, |
| } |