| OLD | NEW |
| 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 20 matching lines...) Expand all Loading... |
| 31 # ......dom/ | 31 # ......dom/ |
| 32 # ........dom.dart | 32 # ........dom.dart |
| 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/ |
| 42 # ........uri.dart |
| 41 # ......(more will come here - io, etc) | 43 # ......(more will come here - io, etc) |
| 42 # ....util/ | 44 # ....util/ |
| 43 # ......(more will come here) | 45 # ......(more will come here) |
| 44 | 46 |
| 45 | 47 |
| 46 | 48 |
| 47 import os | 49 import os |
| 48 import re | 50 import re |
| 49 import sys | 51 import sys |
| 50 import tempfile | 52 import tempfile |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 frog_options_dest.write(re.sub("final config = \'dev\';", | 188 frog_options_dest.write(re.sub("final config = \'dev\';", |
| 187 "final config = \'sdk\';", | 189 "final config = \'sdk\';", |
| 188 frog_options_contents)) | 190 frog_options_contents)) |
| 189 frog_options_dest.close() | 191 frog_options_dest.close() |
| 190 elif filename.endswith('.dart'): | 192 elif filename.endswith('.dart'): |
| 191 copyfile(join(frog_src_dir, filename), join(frog_dest_dir, filename)) | 193 copyfile(join(frog_src_dir, filename), join(frog_dest_dir, filename)) |
| 192 | 194 |
| 193 copytree(join(frog_src_dir, 'leg'), join(frog_dest_dir, 'leg'), | 195 copytree(join(frog_src_dir, 'leg'), join(frog_dest_dir, 'leg'), |
| 194 ignore=ignore_patterns('.svn')) | 196 ignore=ignore_patterns('.svn')) |
| 195 | 197 |
| 198 frog_leg_contents = \ |
| 199 open(join(frog_src_dir, 'leg', 'frog_leg.dart')).read() |
| 200 frog_leg_dest = open(join(frog_dest_dir, 'leg', 'frog_leg.dart'), 'w') |
| 201 frog_leg_dest.write( \ |
| 202 re.sub("../../utils/uri", "../../uri", frog_leg_contents)) |
| 203 frog_leg_dest.close() |
| 204 |
| 205 leg_contents = \ |
| 206 open(join(frog_src_dir, 'leg', 'leg.dart')).read() |
| 207 leg_dest = open(join(frog_dest_dir, 'leg', 'leg.dart'), 'w') |
| 208 leg_dest.write( \ |
| 209 re.sub("../../utils/uri", "../../uri", leg_contents)) |
| 210 leg_dest.close() |
| 211 |
| 212 |
| 196 copytree(join(frog_src_dir, 'server'), join(frog_dest_dir, 'server'), | 213 copytree(join(frog_src_dir, 'server'), join(frog_dest_dir, 'server'), |
| 197 ignore=ignore_patterns('.svn')) | 214 ignore=ignore_patterns('.svn')) |
| 198 | 215 |
| 199 # | 216 # |
| 200 # Create and populate lib/html and lib/htmlimpl. | 217 # Create and populate lib/html and lib/htmlimpl. |
| 201 # | 218 # |
| 202 html_src_dir = join(HOME, 'client', 'html') | 219 html_src_dir = join(HOME, 'client', 'html') |
| 203 html_dest_dir = join(LIB, 'html') | 220 html_dest_dir = join(LIB, 'html') |
| 204 os.makedirs(html_dest_dir) | 221 os.makedirs(html_dest_dir) |
| 205 htmlimpl_dest_dir = join(LIB, 'htmlimpl') | 222 htmlimpl_dest_dir = join(LIB, 'htmlimpl') |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 src_file = join(dom_src_dir, filename) | 256 src_file = join(dom_src_dir, filename) |
| 240 dest_file = join(dom_dest_dir, filename) | 257 dest_file = join(dom_dest_dir, filename) |
| 241 if filename.endswith('.dart') or filename.endswith('.js'): | 258 if filename.endswith('.dart') or filename.endswith('.js'): |
| 242 copyfile(src_file, dest_file) | 259 copyfile(src_file, dest_file) |
| 243 elif isdir(src_file): | 260 elif isdir(src_file): |
| 244 if filename not in ['benchmarks', 'idl', 'scripts', 'snippets', '.svn']: | 261 if filename not in ['benchmarks', 'idl', 'scripts', 'snippets', '.svn']: |
| 245 copytree(src_file, dest_file, | 262 copytree(src_file, dest_file, |
| 246 ignore=ignore_patterns('.svn', 'interface', 'wrapping', | 263 ignore=ignore_patterns('.svn', 'interface', 'wrapping', |
| 247 '*monkey*')) | 264 '*monkey*')) |
| 248 | 265 |
| 266 # |
| 267 # Create and populate lib/uri. |
| 268 # |
| 269 |
| 270 uri_src_dir = join(HOME, 'utils', 'uri') |
| 271 uri_dest_dir = join(LIB, 'uri') |
| 272 os.makedirs(uri_dest_dir) |
| 273 |
| 274 for filename in os.listdir(uri_src_dir): |
| 275 if filename.endswith('.dart'): |
| 276 copyfile(join(uri_src_dir, filename), join(uri_dest_dir, filename)) |
| 277 |
| 249 # | 278 # |
| 250 # Create and populate lib/core. | 279 # Create and populate lib/core. |
| 251 # | 280 # |
| 252 | 281 |
| 253 # First, copy corelib/* to lib/{frog, runtime} | 282 # First, copy corelib/* to lib/{frog, runtime} |
| 254 for filename in corelib_sources: | 283 for filename in corelib_sources: |
| 255 for target_dir in ['frog', 'runtime']: | 284 for target_dir in ['frog', 'runtime']: |
| 256 copyfile(join('corelib', 'src', filename), | 285 copyfile(join('corelib', 'src', filename), |
| 257 join(corelib_dest_dir, target_dir, filename)) | 286 join(corelib_dest_dir, target_dir, filename)) |
| 258 | 287 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 362 |
| 334 # Create and copy tools. | 363 # Create and copy tools. |
| 335 | 364 |
| 336 UTIL = join(SDK_tmp, 'util') | 365 UTIL = join(SDK_tmp, 'util') |
| 337 os.makedirs(UTIL) | 366 os.makedirs(UTIL) |
| 338 | 367 |
| 339 move(SDK_tmp, SDK) | 368 move(SDK_tmp, SDK) |
| 340 | 369 |
| 341 if __name__ == '__main__': | 370 if __name__ == '__main__': |
| 342 sys.exit(Main(sys.argv)) | 371 sys.exit(Main(sys.argv)) |
| OLD | NEW |