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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/test_copier.py

Issue 2831883002: webkitpy: Reduce usage of path_from_webkit_base(). (Closed)
Patch Set: . Created 3 years, 8 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 # 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 """ 54 """
55 self.host = host 55 self.host = host
56 56
57 assert self.host.filesystem.exists(source_repo_path) 57 assert self.host.filesystem.exists(source_repo_path)
58 self.source_repo_path = source_repo_path 58 self.source_repo_path = source_repo_path
59 self.dest_dir_name = dest_dir_name 59 self.dest_dir_name = dest_dir_name
60 60
61 self.filesystem = self.host.filesystem 61 self.filesystem = self.host.filesystem
62 self.webkit_finder = WebKitFinder(self.filesystem) 62 self.webkit_finder = WebKitFinder(self.filesystem)
63 self._webkit_root = self.webkit_finder.webkit_base() 63 self._webkit_root = self.webkit_finder.webkit_base()
64 self.layout_tests_dir = self.webkit_finder.path_from_webkit_base('Layout Tests') 64 self.layout_tests_dir = self.webkit_finder.layout_tests_dir()
65 self.destination_directory = self.filesystem.normpath( 65 self.destination_directory = self.filesystem.normpath(
66 self.filesystem.join( 66 self.filesystem.join(
67 self.layout_tests_dir, 67 self.layout_tests_dir,
68 dest_dir_name, 68 dest_dir_name,
69 self.filesystem.basename(self.source_repo_path))) 69 self.filesystem.basename(self.source_repo_path)))
70 self.import_in_place = (self.source_repo_path == self.destination_direct ory) 70 self.import_in_place = (self.source_repo_path == self.destination_direct ory)
71 self.dir_above_repo = self.filesystem.dirname(self.source_repo_path) 71 self.dir_above_repo = self.filesystem.dirname(self.source_repo_path)
72 72
73 self.import_list = [] 73 self.import_list = []
74 74
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 135
136 copy_list.append({'src': path_full, 'dest': filename}) 136 copy_list.append({'src': path_full, 'dest': filename})
137 137
138 if copy_list: 138 if copy_list:
139 # Only add this directory to the list if there's something to im port 139 # Only add this directory to the list if there's something to im port
140 self.import_list.append({'dirname': root, 'copy_list': copy_list }) 140 self.import_list.append({'dirname': root, 'copy_list': copy_list })
141 141
142 def find_paths_to_skip(self): 142 def find_paths_to_skip(self):
143 paths_to_skip = set() 143 paths_to_skip = set()
144 port = self.host.port_factory.get() 144 port = self.host.port_factory.get()
145 w3c_import_expectations_path = self.webkit_finder.path_from_webkit_base( 'LayoutTests', 'W3CImportExpectations') 145 w3c_import_expectations_path = self.webkit_finder.path_from_layout_tests ('W3CImportExpectations')
146 w3c_import_expectations = self.filesystem.read_text_file(w3c_import_expe ctations_path) 146 w3c_import_expectations = self.filesystem.read_text_file(w3c_import_expe ctations_path)
147 parser = TestExpectationParser(port, all_tests=(), is_lint_mode=False) 147 parser = TestExpectationParser(port, all_tests=(), is_lint_mode=False)
148 expectation_lines = parser.parse(w3c_import_expectations_path, w3c_impor t_expectations) 148 expectation_lines = parser.parse(w3c_import_expectations_path, w3c_impor t_expectations)
149 for line in expectation_lines: 149 for line in expectation_lines:
150 if 'SKIP' in line.expectations: 150 if 'SKIP' in line.expectations:
151 if line.specifiers: 151 if line.specifiers:
152 _log.warning('W3CImportExpectations:%s should not have any s pecifiers', line.line_numbers) 152 _log.warning('W3CImportExpectations:%s should not have any s pecifiers', line.line_numbers)
153 continue 153 continue
154 paths_to_skip.add(line.name) 154 paths_to_skip.add(line.name)
155 return paths_to_skip 155 return paths_to_skip
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 # In other words, there's no sense in overwriting identical files, but 219 # In other words, there's no sense in overwriting identical files, but
220 # there's no harm in copying the identical thing. 220 # there's no harm in copying the identical thing.
221 _log.debug(' copying %s', relpath) 221 _log.debug(' copying %s', relpath)
222 222
223 if not self.import_in_place: 223 if not self.import_in_place:
224 self.filesystem.copyfile(source_path, dest_path) 224 self.filesystem.copyfile(source_path, dest_path)
225 if self.filesystem.read_binary_file(source_path)[:2] == '#!': 225 if self.filesystem.read_binary_file(source_path)[:2] == '#!':
226 self.filesystem.make_executable(dest_path) 226 self.filesystem.make_executable(dest_path)
227 227
228 return dest_path.replace(self._webkit_root, '') 228 return dest_path.replace(self._webkit_root, '')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698