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

Side by Side Diff: dart/tools/dom/scripts/idlsync.py

Issue 12676013: Bring in new IDL files and generated code. Update the script that syncs the idl files to deal with … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « dart/sdk/lib/web_audio/dartium/web_audio_dartium.dart ('k') | deps/all.deps/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 import optparse 6 import optparse
7 import os 7 import os
8 import os.path 8 import os.path
9 import re 9 import re
10 import shutil 10 import shutil
11 import subprocess 11 import subprocess
12 import sys 12 import sys
13 import tempfile
13 14
14 SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__)) 15 SCRIPT_PATH = os.path.abspath(os.path.dirname(__file__))
15 DART_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, '..', '..', '..')) 16 DART_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, '..', '..', '..'))
16 17
17 # Dartium DEPS file with Chrome and WebKit revisions. 18 # Dartium DEPS file with Chrome and WebKit revisions.
18 DEPS = ('http://dart.googlecode.com/svn/branches/' 19 DEPS = ('http://dart.googlecode.com/svn/branches/'
19 'bleeding_edge/deps/dartium.deps/DEPS') 20 'bleeding_edge/deps/dartium.deps/DEPS')
20 21
21 # Whitelist of files to keep. 22 # Whitelist of files to keep.
22 WHITELIST = [ 23 WHITELIST = [
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 readme = template % { 170 readme = template % {
170 'script': os.path.basename(__file__), 171 'script': os.path.basename(__file__),
171 'url': url, 172 'url': url,
172 'revision': revision } 173 'revision': revision }
173 174
174 readme_path = os.path.join(local_path, 'README') 175 readme_path = os.path.join(local_path, 'README')
175 out = open(readme_path, 'w') 176 out = open(readme_path, 'w')
176 out.write(readme) 177 out.write(readme)
177 out.close() 178 out.close()
178 179
180 def SaveVersionControlDir(local_path):
181 version_control_dir = os.path.join(local_path, '.git')
182 if not os.path.isdir(version_control_dir):
183 version_control_dir = os.path.join(local_path, '.svn')
184 if not os.path.isdir(version_control_dir):
185 raise '%s is not a git or svn directory' % local_path
186 temp_dir = tempfile.mkdtemp()
187 shutil.move(version_control_dir, temp_dir)
188 return temp_dir
189
190
191 def RestoreVersionControlDir(local_path, saved_version_control_dir):
192 version_control_dir = os.path.join(saved_version_control_dir, '.git')
193 if not os.path.isdir(version_control_dir):
194 version_control_dir = os.path.join(saved_version_control_dir, '.svn')
195 if not os.path.isdir(version_control_dir):
196 raise 'Failed restoring version control directory'
197 shutil.move(version_control_dir, local_path)
198 shutil.rmtree(saved_version_control_dir)
199
179 200
180 def ParseOptions(): 201 def ParseOptions():
181 parser = optparse.OptionParser() 202 parser = optparse.OptionParser()
182 parser.add_option('--webkit-revision', '-w', dest='webkit_revision', 203 parser.add_option('--webkit-revision', '-w', dest='webkit_revision',
183 help='WebKit IDL revision to install', default=None) 204 help='WebKit IDL revision to install', default=None)
184 parser.add_option('--chrome-revision', '-c', dest='chrome_revision', 205 parser.add_option('--chrome-revision', '-c', dest='chrome_revision',
185 help='Chrome IDL revision to install', default=None) 206 help='Chrome IDL revision to install', default=None)
186 parser.add_option('--update', '-u', dest='update', 207 parser.add_option('--update', '-u', dest='update',
187 help='IDL to update (webkit | chrome | all)', 208 help='IDL to update (webkit | chrome | all)',
188 default='webkit') 209 default='webkit')
189 args, _ = parser.parse_args() 210 args, _ = parser.parse_args()
190 update = {} 211 update = {}
191 if args.update == 'all' or args.update == 'chrome': 212 if args.update == 'all' or args.update == 'chrome':
192 update['chrome'] = args.chrome_revision 213 update['chrome'] = args.chrome_revision
193 if args.update == 'all' or args.update == 'webkit': 214 if args.update == 'all' or args.update == 'webkit':
194 update['webkit'] = args.webkit_revision 215 update['webkit'] = args.webkit_revision
195 return update 216 return update
196 217
197 218
198 def main(): 219 def main():
199 deps = GetDeps() 220 deps = GetDeps()
200 update = ParseOptions() 221 update = ParseOptions()
201 for (component, remote_path, local_path, readme, depth) in UPDATE_LIST: 222 for (component, remote_path, local_path, readme, depth) in UPDATE_LIST:
202 if component in update.keys(): 223 if component in update.keys():
203 revision = update[component] 224 revision = update[component]
204 url, latest = GetSvnRevision(deps, component) 225 url, latest = GetSvnRevision(deps, component)
205 if revision is None: 226 if revision is None:
206 revision = latest 227 revision = latest
228 saved_version_control_dir = SaveVersionControlDir(local_path);
207 RefreshFiles(url, revision, remote_path, local_path, depth) 229 RefreshFiles(url, revision, remote_path, local_path, depth)
208 PruneExtraFiles(local_path) 230 PruneExtraFiles(local_path)
209 GenerateReadme(local_path, readme, url, revision) 231 GenerateReadme(local_path, readme, url, revision)
210 232 RestoreVersionControlDir(local_path, saved_version_control_dir);
211 233
212 if __name__ == '__main__': 234 if __name__ == '__main__':
213 main() 235 main()
OLDNEW
« no previous file with comments | « dart/sdk/lib/web_audio/dartium/web_audio_dartium.dart ('k') | deps/all.deps/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698