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

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

Issue 2247923002: Refactoring: Extract a method _copy_resources_to_wpt in deps_updater.py. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Edited comment to remove unnecessary words. Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Fetches a copy of the latest state of a W3C test repository and commits. 5 """Fetches a copy of the latest state of a W3C test repository and commits.
6 6
7 If this script is given the argument --auto-update, it will also attempt to 7 If this script is given the argument --auto-update, it will also attempt to
8 upload a CL, triggery try jobs, and make any changes that are required for 8 upload a CL, triggery try jobs, and make any changes that are required for
9 new failing tests before committing. 9 new failing tests before committing.
10 """ 10 """
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 if not self.checkout_is_okay(): 46 if not self.checkout_is_okay():
47 return 1 47 return 1
48 48
49 self.print_('## Noting the current Chromium commit.') 49 self.print_('## Noting the current Chromium commit.')
50 _, show_ref_output = self.run(['git', 'show-ref', 'HEAD']) 50 _, show_ref_output = self.run(['git', 'show-ref', 'HEAD'])
51 chromium_commitish = show_ref_output.split()[0] 51 chromium_commitish = show_ref_output.split()[0]
52 52
53 if self.target == 'wpt': 53 if self.target == 'wpt':
54 import_commitish = self.update(WPT_DEST_NAME, WPT_REPO_URL) 54 import_commitish = self.update(WPT_DEST_NAME, WPT_REPO_URL)
55 55 self._copy_resources_to_wpt()
56 for resource in ['testharnessreport.js', 'WebIDLParser.js']:
57 source = self.path_from_webkit_base('LayoutTests', 'resources', resource)
58 destination = self.path_from_webkit_base('LayoutTests', 'importe d', WPT_DEST_NAME, 'resources', resource)
59 self.copyfile(source, destination)
60 self.run(['git', 'add', destination])
61
62 for resource in ['vendor-prefix.js']:
63 source = self.path_from_webkit_base('LayoutTests', 'resources', resource)
64 destination = self.path_from_webkit_base('LayoutTests', 'importe d', WPT_DEST_NAME, 'common', resource)
65 self.copyfile(source, destination)
66 self.run(['git', 'add', destination])
67
68 elif self.target == 'css': 56 elif self.target == 'css':
69 import_commitish = self.update(CSS_DEST_NAME, WPT_REPO_URL) 57 import_commitish = self.update(CSS_DEST_NAME, WPT_REPO_URL)
70 else: 58 else:
71 raise AssertionError("Unsupported target %s" % self.target) 59 raise AssertionError("Unsupported target %s" % self.target)
72 60
73 has_changes = self.commit_changes_if_needed(chromium_commitish, import_c ommitish) 61 has_changes = self.commit_changes_if_needed(chromium_commitish, import_c ommitish)
74 62
75 if self.auto_update and has_changes: 63 if self.auto_update and has_changes:
76 self.do_auto_update() 64 self.do_auto_update()
77 return 0 65 return 0
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 if self.fs.exists(self.path_from_webkit_base(WPT_DEST_NAME)): 102 if self.fs.exists(self.path_from_webkit_base(WPT_DEST_NAME)):
115 self.print_('## WebKit/%s exists; aborting.' % WPT_DEST_NAME) 103 self.print_('## WebKit/%s exists; aborting.' % WPT_DEST_NAME)
116 return False 104 return False
117 105
118 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)): 106 if self.fs.exists(self.path_from_webkit_base(CSS_DEST_NAME)):
119 self.print_('## WebKit/%s repo exists; aborting.' % CSS_DEST_NAME) 107 self.print_('## WebKit/%s repo exists; aborting.' % CSS_DEST_NAME)
120 return False 108 return False
121 109
122 return True 110 return True
123 111
112 def _copy_resources_to_wpt(self):
113 """Copies some files over to a newly-updated wpt directory.
114
115 There are some resources in our repository that we use instead of the
116 upstream versions.
117 """
118 resources_to_copy = [
119 ('testharnessreport.js', 'resources'),
120 ('WebIDLParser.js', 'resources'),
121 ('vendor-prefix.js', 'common'),
122 ]
123 for filename, wpt_subdir in resources_to_copy:
124 source = self.path_from_webkit_base('LayoutTests', 'resources', file name)
125 destination = self.path_from_webkit_base('LayoutTests', 'imported', WPT_DEST_NAME, wpt_subdir, filename)
126 self.copyfile(source, destination)
127 self.run(['git', 'add', destination])
128
124 def update(self, dest_dir_name, url): 129 def update(self, dest_dir_name, url):
125 """Updates an imported repository. 130 """Updates an imported repository.
126 131
127 Args: 132 Args:
128 dest_dir_name: The destination directory name. 133 dest_dir_name: The destination directory name.
129 url: URL of the git repository. 134 url: URL of the git repository.
130 135
131 Returns: 136 Returns:
132 A string for the commit description "<destination>@<commitish>". 137 A string for the commit description "<destination>@<commitish>".
133 """ 138 """
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 return sets 385 return sets
381 386
382 def write_test_expectations(self): 387 def write_test_expectations(self):
383 self.print_('## Adding test expectations lines to LayoutTests/TestExpect ations.') 388 self.print_('## Adding test expectations lines to LayoutTests/TestExpect ations.')
384 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c -test-expectations') 389 script_path = self.path_from_webkit_base('Tools', 'Scripts', 'update-w3c -test-expectations')
385 self.run([self.host.executable, script_path]) 390 self.run([self.host.executable, script_path])
386 message = '\'Modifies TestExpectations and/or downloads new baselines fo r tests\'' 391 message = '\'Modifies TestExpectations and/or downloads new baselines fo r tests\''
387 self.check_run(['git', 'commit', '-a', '-m', message]) 392 self.check_run(['git', 'commit', '-a', '-m', message])
388 self.check_run(['git', 'cl', 'upload', '-m', message, 393 self.check_run(['git', 'cl', 'upload', '-m', message,
389 '--auth-refresh-token-json', self.auth_refresh_token_jso n]) 394 '--auth-refresh-token-json', self.auth_refresh_token_jso n])
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698