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

Side by Side Diff: tools/create_sdk.py

Issue 9325085: Move utils/{uri, utf8} to lib/{uri, utf8} . (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 10 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 | « tests/utils/src/UriTest.dart ('k') | utils/uri/uri.dart » ('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/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 # A script which will be invoked from gyp to create an SDK. 7 # A script which will be invoked from gyp to create an SDK.
8 # 8 #
9 # Usage: create_sdk.py sdk_directory 9 # Usage: create_sdk.py sdk_directory
10 # 10 #
(...skipping 22 matching lines...) Expand all
33 # ......frog/ 33 # ......frog/
34 # ......html/ 34 # ......html/
35 # ........html.dart 35 # ........html.dart
36 # ......htmlimpl/ 36 # ......htmlimpl/
37 # ........htmlimpl.dart 37 # ........htmlimpl.dart
38 # ......json/ 38 # ......json/
39 # ........json_{frog}.dart 39 # ........json_{frog}.dart
40 # ........{frog}/ 40 # ........{frog}/
41 # ......uri/ 41 # ......uri/
42 # ........uri.dart 42 # ........uri.dart
43 # ......(more will come here - io, etc) 43 # ......utf8/
44 # ........utf8.dart
45 # ......(more will come here)
44 # ....util/ 46 # ....util/
45 # ......(more will come here) 47 # ......(more will come here)
46 48
47 49
48 50
49 import os 51 import os
50 import re 52 import re
51 import sys 53 import sys
52 import tempfile 54 import tempfile
53 import utils 55 import utils
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 # change config from 'dev' to 'sdk' in frog_options.dart 187 # change config from 'dev' to 'sdk' in frog_options.dart
186 frog_options_contents = open(join(frog_src_dir, filename)).read() 188 frog_options_contents = open(join(frog_src_dir, filename)).read()
187 frog_options_dest = open(join(frog_dest_dir, filename), 'w') 189 frog_options_dest = open(join(frog_dest_dir, filename), 'w')
188 frog_options_dest.write(re.sub("final config = \'dev\';", 190 frog_options_dest.write(re.sub("final config = \'dev\';",
189 "final config = \'sdk\';", 191 "final config = \'sdk\';",
190 frog_options_contents)) 192 frog_options_contents))
191 frog_options_dest.close() 193 frog_options_dest.close()
192 elif filename.endswith('.dart'): 194 elif filename.endswith('.dart'):
193 copyfile(join(frog_src_dir, filename), join(frog_dest_dir, filename)) 195 copyfile(join(frog_src_dir, filename), join(frog_dest_dir, filename))
194 196
195 copytree(join(frog_src_dir, 'leg'), join(frog_dest_dir, 'leg'), 197 leg_dest_dir = join(frog_dest_dir, 'leg')
198 copytree(join(frog_src_dir, 'leg'), leg_dest_dir,
196 ignore=ignore_patterns('.svn')) 199 ignore=ignore_patterns('.svn'))
197 200
198 frog_leg_contents = \ 201 # Remap imports in frog/leg/* .
199 open(join(frog_src_dir, 'leg', 'frog_leg.dart')).read() 202 for filename in os.listdir(leg_dest_dir):
200 frog_leg_dest = open(join(frog_dest_dir, 'leg', 'frog_leg.dart'), 'w') 203 if filename.endswith('.dart'):
201 frog_leg_dest.write( \ 204 file_contents = open(join(leg_dest_dir, filename)).read()
202 re.sub("../../utils/uri", "../../uri", frog_leg_contents)) 205 file = open(join(leg_dest_dir, filename), 'w')
203 frog_leg_dest.close() 206 file.write(re.sub("../../lib", "../..", file_contents))
207 file.close()
204 208
205 leg_contents = \ 209 # Remap imports in frog/leg/*/* .
206 open(join(frog_src_dir, 'leg', 'leg.dart')).read() 210 for (_, subdirs, _) in os.walk(leg_dest_dir):
207 leg_dest = open(join(frog_dest_dir, 'leg', 'leg.dart'), 'w') 211 for subdir in subdirs:
208 leg_dest.write( \ 212 for filename in os.listdir(join(leg_dest_dir, subdir)):
209 re.sub("../../utils/uri", "../../uri", leg_contents)) 213 if filename.endswith('.dart'):
210 leg_dest.close() 214 file_contents = open(join(leg_dest_dir, subdir, filename)).read()
211 215 file = open(join(leg_dest_dir, subdir, filename), 'w')
216 file.write(re.sub("../../../lib", "../../..", file_contents))
217 file.close()
212 218
213 copytree(join(frog_src_dir, 'server'), join(frog_dest_dir, 'server'), 219 copytree(join(frog_src_dir, 'server'), join(frog_dest_dir, 'server'),
214 ignore=ignore_patterns('.svn')) 220 ignore=ignore_patterns('.svn'))
215 221
216 # 222 #
217 # Create and populate lib/html and lib/htmlimpl. 223 # Create and populate lib/html and lib/htmlimpl.
218 # 224 #
219 html_src_dir = join(HOME, 'client', 'html') 225 html_src_dir = join(HOME, 'client', 'html')
220 html_dest_dir = join(LIB, 'html') 226 html_dest_dir = join(LIB, 'html')
221 os.makedirs(html_dest_dir) 227 os.makedirs(html_dest_dir)
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 dest_file = join(dom_dest_dir, filename) 263 dest_file = join(dom_dest_dir, filename)
258 if filename.endswith('.dart') or filename.endswith('.js'): 264 if filename.endswith('.dart') or filename.endswith('.js'):
259 copyfile(src_file, dest_file) 265 copyfile(src_file, dest_file)
260 elif isdir(src_file): 266 elif isdir(src_file):
261 if filename not in ['benchmarks', 'idl', 'scripts', 'snippets', '.svn']: 267 if filename not in ['benchmarks', 'idl', 'scripts', 'snippets', '.svn']:
262 copytree(src_file, dest_file, 268 copytree(src_file, dest_file,
263 ignore=ignore_patterns('.svn', 'interface', 'wrapping', 269 ignore=ignore_patterns('.svn', 'interface', 'wrapping',
264 '*monkey*')) 270 '*monkey*'))
265 271
266 # 272 #
267 # Create and populate lib/uri. 273 # Create and populate lib/{uri, utf8} .
268 # 274 #
269 275
270 uri_src_dir = join(HOME, 'utils', 'uri') 276 for library in ['uri', 'utf8']:
271 uri_dest_dir = join(LIB, 'uri') 277 src_dir = join(HOME, 'lib', library)
272 os.makedirs(uri_dest_dir) 278 dest_dir = join(LIB, library)
279 os.makedirs(dest_dir)
273 280
274 for filename in os.listdir(uri_src_dir): 281 for filename in os.listdir(src_dir):
275 if filename.endswith('.dart'): 282 if filename.endswith('.dart'):
276 copyfile(join(uri_src_dir, filename), join(uri_dest_dir, filename)) 283 copyfile(join(src_dir, filename), join(dest_dir, filename))
277 284
278 # 285 #
279 # Create and populate lib/core. 286 # Create and populate lib/core.
280 # 287 #
281 288
282 # First, copy corelib/* to lib/{frog, runtime} 289 # First, copy corelib/* to lib/{frog, runtime}
283 for filename in corelib_sources: 290 for filename in corelib_sources:
284 for target_dir in ['frog', 'runtime']: 291 for target_dir in ['frog', 'runtime']:
285 copyfile(join('corelib', 'src', filename), 292 copyfile(join('corelib', 'src', filename),
286 join(corelib_dest_dir, target_dir, filename)) 293 join(corelib_dest_dir, target_dir, filename))
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 369
363 # Create and copy tools. 370 # Create and copy tools.
364 371
365 UTIL = join(SDK_tmp, 'util') 372 UTIL = join(SDK_tmp, 'util')
366 os.makedirs(UTIL) 373 os.makedirs(UTIL)
367 374
368 move(SDK_tmp, SDK) 375 move(SDK_tmp, SDK)
369 376
370 if __name__ == '__main__': 377 if __name__ == '__main__':
371 sys.exit(Main(sys.argv)) 378 sys.exit(Main(sys.argv))
OLDNEW
« no previous file with comments | « tests/utils/src/UriTest.dart ('k') | utils/uri/uri.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698