diff options
7 files changed, 35 insertions, 12 deletions
diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py b/chromium/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py index 05e9ffd8906..79ec4331b02 100755 --- a/chromium/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py +++ b/chromium/third_party/WebKit/Source/bindings/scripts/aggregate_generated_bindings.py @@ -53,7 +53,7 @@ import os import re import sys -from utilities import should_generate_impl_file_from_idl, get_file_contents, idl_filename_to_component, idl_filename_to_interface_name, read_idl_files_list_from_file +from utilities import should_generate_impl_file_from_idl, get_file_contents, idl_filename_to_component, idl_filename_to_interface_name, read_idl_files_list_from_file, abs # A regexp for finding Conditional attributes in interface definitions. CONDITIONAL_PATTERN = re.compile( @@ -181,7 +181,7 @@ def main(args): if len(args) <= 4: raise Exception('Expected at least 5 arguments.') component_dir = args[1] - input_file_name = args[2] + input_file_name = abs(args[2]) in_out_break_index = args.index('--') output_file_names = args[in_out_break_index + 1:] @@ -201,7 +201,7 @@ def main(args): file_contents = generate_content(component_dir, aggregate_partial_interfaces, files_meta_data_this_partition) - write_content(file_contents, file_name) + write_content(file_contents, abs(file_name)) if __name__ == '__main__': diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py b/chromium/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py index 90efcc7f03f..fb19e6e6196 100644 --- a/chromium/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py +++ b/chromium/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py @@ -80,7 +80,7 @@ import v8_interface import v8_types import v8_union from v8_utilities import capitalize, cpp_name, conditional_string, v8_class_name -from utilities import KNOWN_COMPONENTS, idl_filename_to_component, is_valid_component_dependency, is_testing_target +from utilities import KNOWN_COMPONENTS, idl_filename_to_component, is_valid_component_dependency, is_testing_target, abs def render_template(include_paths, header_template, cpp_template, @@ -429,7 +429,7 @@ def runtime_enabled_if(code, runtime_enabled_function_name): def main(argv): # If file itself executed, cache templates try: - cache_dir = argv[1] + cache_dir = abs(argv[1]) dummy_filename = argv[2] except IndexError as err: print 'Usage: %s CACHE_DIR DUMMY_FILENAME' % argv[0] diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/idl_compiler.py b/chromium/third_party/WebKit/Source/bindings/scripts/idl_compiler.py index 7734def8dbe..8c9fc08f557 100755 --- a/chromium/third_party/WebKit/Source/bindings/scripts/idl_compiler.py +++ b/chromium/third_party/WebKit/Source/bindings/scripts/idl_compiler.py @@ -40,7 +40,7 @@ import sys from code_generator_v8 import CodeGeneratorDictionaryImpl, CodeGeneratorV8, CodeGeneratorUnionType from idl_reader import IdlReader -from utilities import create_component_info_provider, read_idl_files_list_from_file, write_file, idl_filename_to_component +from utilities import create_component_info_provider, read_idl_files_list_from_file, write_file, idl_filename_to_component, abs def parse_options(): @@ -148,8 +148,8 @@ def generate_bindings(options, input_filename): info_provider = create_component_info_provider( options.info_dir, options.target_component) idl_compiler = IdlCompilerV8( - options.output_directory, - cache_directory=options.cache_directory, + abs(options.output_directory), + cache_directory=abs(options.cache_directory), info_provider=info_provider, only_if_changed=options.write_file_only_if_changed, target_component=options.target_component) diff --git a/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py b/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py index 8bd855514bd..c94bcdf1c9d 100644 --- a/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py +++ b/chromium/third_party/WebKit/Source/bindings/scripts/utilities.py @@ -212,13 +212,20 @@ def create_component_info_provider(info_dir, component): # Basic file reading/writing ################################################################################ +def abs(filename): + # open, abspath, etc. are all limited to the 260 char MAX_PATH and this causes + # problems when we try to resolve long relative paths in the WebKit directory structure. + return os.path.normpath(os.path.join(os.getcwd(), filename)) + def get_file_contents(filename): + filename = abs(filename) with open(filename) as f: return f.read() def read_file_to_list(filename): """Returns a list of (stripped) lines for a given filename.""" + filename = abs(filename) with open(filename) as f: return [line.rstrip('\n') for line in f] @@ -240,7 +247,7 @@ def resolve_cygpath(cygdrive_names): def read_idl_files_list_from_file(filename): """Similar to read_file_to_list, but also resolves cygpath.""" - with open(filename) as input_file: + with open(abs(filename)) as input_file: file_names = sorted([os.path.realpath(line.rstrip('\n')) for line in input_file]) idl_file_names = [file_name for file_name in file_names @@ -253,11 +260,13 @@ def read_idl_files_list_from_file(filename): def read_pickle_files(pickle_filenames): for pickle_filename in pickle_filenames: + pickle_filename = abs(pickle_filename) with open(pickle_filename) as pickle_file: yield pickle.load(pickle_file) def write_file(new_text, destination_filename, only_if_changed): + destination_filename = abs(destination_filename) if only_if_changed and os.path.isfile(destination_filename): with open(destination_filename) as destination_file: if destination_file.read() == new_text: @@ -270,6 +279,7 @@ def write_file(new_text, destination_filename, only_if_changed): def write_pickle_file(pickle_filename, data, only_if_changed): + pickle_filename = abs(pickle_filename) if only_if_changed and os.path.isfile(pickle_filename): with open(pickle_filename) as pickle_file: try: diff --git a/chromium/third_party/WebKit/Source/build/scripts/rule_bison.py b/chromium/third_party/WebKit/Source/build/scripts/rule_bison.py index 870f3b56f28..e72e87e56fe 100755 --- a/chromium/third_party/WebKit/Source/build/scripts/rule_bison.py +++ b/chromium/third_party/WebKit/Source/build/scripts/rule_bison.py @@ -41,11 +41,12 @@ import os import os.path import subprocess import sys +from utilities import abs assert len(sys.argv) == 3 or len(sys.argv) == 4 -inputFile = sys.argv[1] -outputDir = sys.argv[2] +inputFile = abs(sys.argv[1]) +outputDir = abs(sys.argv[2]) bisonExe = 'bison' if len(sys.argv) > 3: bisonExe = sys.argv[3] diff --git a/chromium/third_party/WebKit/Source/build/scripts/utilities.py b/chromium/third_party/WebKit/Source/build/scripts/utilities.py new file mode 100644 index 00000000000..f236b04cc77 --- /dev/null +++ b/chromium/third_party/WebKit/Source/build/scripts/utilities.py @@ -0,0 +1,10 @@ +# Copyright 2014 The Chromium Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os + +def abs(filename): + # open, abspath, etc. are all limited to the 260 char MAX_PATH and this causes + # problems when we try to resolve long relative paths in the WebKit directory structure. + return os.path.normpath(os.path.join(os.getcwd(), filename)) diff --git a/chromium/third_party/jinja2/bccache.py b/chromium/third_party/jinja2/bccache.py index f2f9db61b31..332220a2238 100644 --- a/chromium/third_party/jinja2/bccache.py +++ b/chromium/third_party/jinja2/bccache.py @@ -207,7 +207,9 @@ class FileSystemBytecodeCache(BytecodeCache): self.pattern = pattern def _get_cache_filename(self, bucket): - return path.join(self.directory, self.pattern % bucket.key) + # Relative path might be longer than 260 characters (MAX_PATH) especially when + # shadow building on Windows. To avoid errors use potentially shorter absolute paths. + return path.join(path.abspath(self.directory), self.pattern % bucket.key) def load_bytecode(self, bucket): f = open_if_exists(self._get_cache_filename(bucket), 'rb') |