| OLD | NEW |
| 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 1 # Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions | 4 # modification, are permitted provided that the following conditions |
| 5 # are met: | 5 # are met: |
| 6 # | 6 # |
| 7 # 1. Redistributions of source code must retain the above | 7 # 1. Redistributions of source code must retain the above |
| 8 # copyright notice, this list of conditions and the following | 8 # copyright notice, this list of conditions and the following |
| 9 # disclaimer. | 9 # disclaimer. |
| 10 # 2. Redistributions in binary form must reproduce the above | 10 # 2. Redistributions in binary form must reproduce the above |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 if d in dirs: | 186 if d in dirs: |
| 187 dirs.remove(d) | 187 dirs.remove(d) |
| 188 | 188 |
| 189 for path in paths_to_skip: | 189 for path in paths_to_skip: |
| 190 path_base = path.replace(self.options.destination + '/', '') | 190 path_base = path.replace(self.options.destination + '/', '') |
| 191 path_base = path_base.replace(cur_dir, '') | 191 path_base = path_base.replace(cur_dir, '') |
| 192 path_full = self.filesystem.join(root, path_base) | 192 path_full = self.filesystem.join(root, path_base) |
| 193 if path_base in dirs: | 193 if path_base in dirs: |
| 194 dirs.remove(path_base) | 194 dirs.remove(path_base) |
| 195 if not self.options.dry_run and self.import_in_place: | 195 if not self.options.dry_run and self.import_in_place: |
| 196 _log.info(" pruning %s" % path_base) | 196 _log.info(" pruning %s", path_base) |
| 197 self.filesystem.rmtree(path_full) | 197 self.filesystem.rmtree(path_full) |
| 198 else: | 198 else: |
| 199 _log.info(" skipping %s" % path_base) | 199 _log.info(" skipping %s", path_base) |
| 200 | 200 |
| 201 copy_list = [] | 201 copy_list = [] |
| 202 | 202 |
| 203 for filename in files: | 203 for filename in files: |
| 204 path_full = self.filesystem.join(root, filename) | 204 path_full = self.filesystem.join(root, filename) |
| 205 path_base = path_full.replace(self.source_repo_path + '/', '') | 205 path_base = path_full.replace(self.source_repo_path + '/', '') |
| 206 path_base = self.destination_directory.replace(self.layout_tests
_dir + '/', '') + '/' + path_base | 206 path_base = self.destination_directory.replace(self.layout_tests
_dir + '/', '') + '/' + path_base |
| 207 if path_base in paths_to_skip: | 207 if path_base in paths_to_skip: |
| 208 if not self.options.dry_run and self.import_in_place: | 208 if not self.options.dry_run and self.import_in_place: |
| 209 _log.info(" pruning %s" % path_base) | 209 _log.info(" pruning %s", path_base) |
| 210 self.filesystem.remove(path_full) | 210 self.filesystem.remove(path_full) |
| 211 continue | 211 continue |
| 212 else: | 212 else: |
| 213 continue | 213 continue |
| 214 # FIXME: This block should really be a separate function, but th
e early-continues make that difficult. | 214 # FIXME: This block should really be a separate function, but th
e early-continues make that difficult. |
| 215 | 215 |
| 216 if filename.startswith('.') or filename.endswith('.pl'): | 216 if filename.startswith('.') or filename.endswith('.pl'): |
| 217 continue # For some reason the w3c repo contains random per
l scripts we don't care about. | 217 continue # For some reason the w3c repo contains random per
l scripts we don't care about. |
| 218 if filename == 'OWNERS' or filename == 'reftest.list': | 218 if filename == 'OWNERS' or filename == 'reftest.list': |
| 219 continue # These files fail our presubmits. | 219 continue # These files fail our presubmits. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 289 |
| 290 paths_to_skip = set() | 290 paths_to_skip = set() |
| 291 port = self.host.port_factory.get() | 291 port = self.host.port_factory.get() |
| 292 w3c_import_expectations_path = self.webkit_finder.path_from_webkit_base(
'LayoutTests', 'W3CImportExpectations') | 292 w3c_import_expectations_path = self.webkit_finder.path_from_webkit_base(
'LayoutTests', 'W3CImportExpectations') |
| 293 w3c_import_expectations = self.filesystem.read_text_file(w3c_import_expe
ctations_path) | 293 w3c_import_expectations = self.filesystem.read_text_file(w3c_import_expe
ctations_path) |
| 294 parser = TestExpectationParser(port, all_tests=(), is_lint_mode=False) | 294 parser = TestExpectationParser(port, all_tests=(), is_lint_mode=False) |
| 295 expectation_lines = parser.parse(w3c_import_expectations_path, w3c_impor
t_expectations) | 295 expectation_lines = parser.parse(w3c_import_expectations_path, w3c_impor
t_expectations) |
| 296 for line in expectation_lines: | 296 for line in expectation_lines: |
| 297 if 'SKIP' in line.expectations: | 297 if 'SKIP' in line.expectations: |
| 298 if line.specifiers: | 298 if line.specifiers: |
| 299 _log.warning("W3CImportExpectations:%s should not have any s
pecifiers" % line.line_numbers) | 299 _log.warning("W3CImportExpectations:%s should not have any s
pecifiers", line.line_numbers) |
| 300 continue | 300 continue |
| 301 paths_to_skip.add(line.name) | 301 paths_to_skip.add(line.name) |
| 302 return paths_to_skip | 302 return paths_to_skip |
| 303 | 303 |
| 304 def import_tests(self): | 304 def import_tests(self): |
| 305 """Reads |self.import_list|, and converts and copies files to their dest
ination.""" | 305 """Reads |self.import_list|, and converts and copies files to their dest
ination.""" |
| 306 total_imported_tests = 0 | 306 total_imported_tests = 0 |
| 307 total_imported_reftests = 0 | 307 total_imported_reftests = 0 |
| 308 total_imported_jstests = 0 | 308 total_imported_jstests = 0 |
| 309 total_prefixed_properties = {} | 309 total_prefixed_properties = {} |
| (...skipping 17 matching lines...) Expand all Loading... |
| 327 self.filesystem.maybe_make_directory(new_path) | 327 self.filesystem.maybe_make_directory(new_path) |
| 328 | 328 |
| 329 copied_files = [] | 329 copied_files = [] |
| 330 | 330 |
| 331 for file_to_copy in dir_to_copy['copy_list']: | 331 for file_to_copy in dir_to_copy['copy_list']: |
| 332 # FIXME: Split this block into a separate function. | 332 # FIXME: Split this block into a separate function. |
| 333 orig_filepath = self.filesystem.normpath(file_to_copy['src']) | 333 orig_filepath = self.filesystem.normpath(file_to_copy['src']) |
| 334 | 334 |
| 335 if self.filesystem.isdir(orig_filepath): | 335 if self.filesystem.isdir(orig_filepath): |
| 336 # FIXME: Figure out what is triggering this and what to do a
bout it. | 336 # FIXME: Figure out what is triggering this and what to do a
bout it. |
| 337 _log.error('%s refers to a directory' % orig_filepath) | 337 _log.error('%s refers to a directory', orig_filepath) |
| 338 continue | 338 continue |
| 339 | 339 |
| 340 if not self.filesystem.exists(orig_filepath): | 340 if not self.filesystem.exists(orig_filepath): |
| 341 _log.warning('%s not found. Possible error in the test.', or
ig_filepath) | 341 _log.warning('%s not found. Possible error in the test.', or
ig_filepath) |
| 342 continue | 342 continue |
| 343 | 343 |
| 344 new_filepath = self.filesystem.join(new_path, file_to_copy['dest
']) | 344 new_filepath = self.filesystem.join(new_path, file_to_copy['dest
']) |
| 345 if 'reference_support_info' in file_to_copy.keys() and file_to_c
opy['reference_support_info'] != {}: | 345 if 'reference_support_info' in file_to_copy.keys() and file_to_c
opy['reference_support_info'] != {}: |
| 346 reference_support_info = file_to_copy['reference_support_inf
o'] | 346 reference_support_info = file_to_copy['reference_support_inf
o'] |
| 347 else: | 347 else: |
| 348 reference_support_info = None | 348 reference_support_info = None |
| 349 | 349 |
| 350 if not self.filesystem.exists(self.filesystem.dirname(new_filepa
th)): | 350 if not self.filesystem.exists(self.filesystem.dirname(new_filepa
th)): |
| 351 if not self.import_in_place and not self.options.dry_run: | 351 if not self.import_in_place and not self.options.dry_run: |
| 352 self.filesystem.maybe_make_directory(self.filesystem.dir
name(new_filepath)) | 352 self.filesystem.maybe_make_directory(self.filesystem.dir
name(new_filepath)) |
| 353 | 353 |
| 354 relpath = self.filesystem.relpath(new_filepath, self.layout_test
s_dir) | 354 relpath = self.filesystem.relpath(new_filepath, self.layout_test
s_dir) |
| 355 if not self.options.overwrite and self.filesystem.exists(new_fil
epath): | 355 if not self.options.overwrite and self.filesystem.exists(new_fil
epath): |
| 356 _log.info(' skipping %s' % relpath) | 356 _log.info(' skipping %s', relpath) |
| 357 else: | 357 else: |
| 358 # FIXME: Maybe doing a file diff is in order here for existi
ng files? | 358 # FIXME: Maybe doing a file diff is in order here for existi
ng files? |
| 359 # In other words, there's no sense in overwriting identical
files, but | 359 # In other words, there's no sense in overwriting identical
files, but |
| 360 # there's no harm in copying the identical thing. | 360 # there's no harm in copying the identical thing. |
| 361 _log.info(' %s' % relpath) | 361 _log.info(' %s', relpath) |
| 362 | 362 |
| 363 # Only HTML, XML, or CSS should be converted. | 363 # Only HTML, XML, or CSS should be converted. |
| 364 # FIXME: Eventually, so should JS when support is added for this
type of conversion. | 364 # FIXME: Eventually, so should JS when support is added for this
type of conversion. |
| 365 mimetype = mimetypes.guess_type(orig_filepath) | 365 mimetype = mimetypes.guess_type(orig_filepath) |
| 366 if 'is_jstest' not in file_to_copy and ( | 366 if 'is_jstest' not in file_to_copy and ( |
| 367 'html' in str(mimetype[0]) or 'xml' in str(mimetype[0])
or 'css' in str(mimetype[0])): | 367 'html' in str(mimetype[0]) or 'xml' in str(mimetype[0])
or 'css' in str(mimetype[0])): |
| 368 converted_file = convert_for_webkit(new_path, filename=orig_
filepath, | 368 converted_file = convert_for_webkit(new_path, filename=orig_
filepath, |
| 369 reference_support_info=r
eference_support_info) | 369 reference_support_info=r
eference_support_info) |
| 370 | 370 |
| 371 if not converted_file: | 371 if not converted_file: |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 _log.info(' %s: %s', prefixed_property, total_prefixed_properti
es[prefixed_property]) | 404 _log.info(' %s: %s', prefixed_property, total_prefixed_properti
es[prefixed_property]) |
| 405 | 405 |
| 406 def path_too_long(self, source_path): | 406 def path_too_long(self, source_path): |
| 407 """Checks whether a source path is too long to import. | 407 """Checks whether a source path is too long to import. |
| 408 | 408 |
| 409 Args: | 409 Args: |
| 410 Absolute path of file to be imported. | 410 Absolute path of file to be imported. |
| 411 """ | 411 """ |
| 412 path_from_repo_base = os.path.relpath(source_path, self.source_repo_path
) | 412 path_from_repo_base = os.path.relpath(source_path, self.source_repo_path
) |
| 413 return len(path_from_repo_base) > MAX_PATH_LENGTH | 413 return len(path_from_repo_base) > MAX_PATH_LENGTH |
| OLD | NEW |