Chromium Code Reviews| Index: tools/create_sdk.py |
| diff --git a/tools/create_sdk.py b/tools/create_sdk.py |
| index b95147a4ec43e0a9661f1e763f9c9413c2d2693a..ee81d28eae7146455d92f8eca17728c7a7210554 100755 |
| --- a/tools/create_sdk.py |
| +++ b/tools/create_sdk.py |
| @@ -15,6 +15,7 @@ |
| # ....bin/ |
| # ......dart or dart.exe (executable) |
| # ......frogc.dart |
| +# ......pub |
| # ....lib/ |
| # ......builtin/ |
| # ........builtin_runtime.dart |
| @@ -44,8 +45,10 @@ |
| # ......uri/ |
| # ........uri.dart |
| # ......utf/ |
| +# ......yaml/ |
|
dgrove
2012/04/28 13:26:06
I think yaml should be a subdirectory under util/p
Bob Nystrom
2012/04/30 17:30:56
It seemed consistent to me to put it next to JSON,
dgrove
2012/05/01 09:21:48
I don't think this is a commonly-desired library f
nweiz
2012/05/01 18:12:54
I don't understand why we wouldn't put a general-p
|
| # ......(more will come here) |
| # ....util/ |
| +# ......pub/ |
| # ......(more will come here) |
| @@ -57,7 +60,7 @@ import tempfile |
| import utils |
| # TODO(dgrove): Only import modules following Google style guide. |
| -from os.path import dirname, join, realpath, exists, isdir |
| +from os.path import basename, dirname, join, realpath, exists, isdir |
| # TODO(dgrove): Only import modules following Google style guide. |
| from shutil import copyfile, copymode, copytree, ignore_patterns, rmtree, move |
| @@ -74,6 +77,20 @@ def ReplaceInFiles(paths, subs): |
| dest.write(contents) |
| dest.close() |
| +def CopyShellScript(src_file, dest_dir): |
| + '''Copies a shell/batch script to the given destination directory. Handles |
| + using the appropriate platform-specific file extension.''' |
| + file_extension = '' |
| + if utils.GuessOS() == 'win32': |
| + file_extension = '.bat' |
| + |
| + src = src_file + file_extension |
| + dest = join(dest_dir, basename(src_file) + file_extension) |
| + |
| + copyfile(src, dest) |
| + copymode(src, dest) |
| + |
| + |
| def Main(argv): |
| # Pull in all of the gpyi files which will be munged into the sdk. |
| builtin_runtime_sources = \ |
| @@ -111,20 +128,16 @@ def Main(argv): |
| # Copy the Dart VM binary into sdk/bin. |
| # TODO(dgrove) - deal with architectures that are not ia32. |
| build_dir = os.path.dirname(argv[1]) |
| - frogc_file_extension = '' |
| dart_file_extension = '' |
| if utils.GuessOS() == 'win32': |
| dart_file_extension = '.exe' |
| - frogc_file_extension = '.bat' |
| dart_src_binary = join(HOME, build_dir, 'dart' + dart_file_extension) |
| dart_dest_binary = join(BIN, 'dart' + dart_file_extension) |
| - frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap', |
| - 'frogc' + frogc_file_extension) |
| - frogc_dest_binary = join(BIN, 'frogc' + frogc_file_extension) |
| copyfile(dart_src_binary, dart_dest_binary) |
| copymode(dart_src_binary, dart_dest_binary) |
| - copyfile(frogc_src_binary, frogc_dest_binary) |
| - copymode(frogc_src_binary, frogc_dest_binary) |
| + |
| + frogc_src_binary = join(HOME, 'frog', 'scripts', 'bootstrap', 'frogc') |
| + CopyShellScript(frogc_src_binary, BIN) |
| # Create sdk/bin/frogc.dart, and hack as needed. |
| frog_src_dir = join(HOME, 'frog') |
| @@ -136,6 +149,10 @@ def Main(argv): |
| re.sub(r"#import\('([^.])", r"#import('../lib/frog/\1", frogc_contents)) |
| frogc_dest.close() |
| + # Create pub shell script. |
| + pub_src_script = join(HOME, 'utils', 'pub', 'sdk', 'pub') |
| + CopyShellScript(pub_src_script, BIN) |
| + |
| # TODO(dgrove): copy and fix up frog.dart, minfrogc.dart. |
| # |
| @@ -313,7 +330,7 @@ def Main(argv): |
| # Create and populate lib/isolate |
| copytree(join(HOME, 'lib', 'isolate'), join(LIB, 'isolate'), |
| ignore=ignore_patterns('.svn')) |
| - |
| + |
| isolate_runtime_dir = join(LIB, 'isolate', 'runtime') |
| # path seems to exist when run locally, but not on builder |
| if not exists(isolate_runtime_dir): |
| @@ -410,11 +427,26 @@ def Main(argv): |
| dest_file.write('#source("runtime/' + filename + '");\n') |
| dest_file.close() |
| + # Create and populate lib/yaml |
| + yaml_src_dir = join(HOME, 'utils', 'yaml') |
| + yaml_dest_dir = join(LIB, 'yaml') |
| + copytree(yaml_src_dir, yaml_dest_dir, ignore=ignore_patterns('.svn')) |
| + |
| # Create and copy tools. |
| UTIL = join(SDK_tmp, 'util') |
| os.makedirs(UTIL) |
| + # Create and populate util/pub |
| + pub_src_dir = join(HOME, 'utils', 'pub') |
| + pub_dst_dir = join(UTIL, 'pub') |
| + copytree(pub_src_dir, pub_dst_dir, |
| + ignore=ignore_patterns('.svn', 'sdk')) |
| + ReplaceInFiles([ |
| + join(UTIL, 'pub', 'pub.dart') |
| + ], [ |
| + ("'../yaml/yaml.dart'", "'../../lib/yaml/yaml.dart'") |
| + ]) |
| # Copy import maps |
| PLATFORMS = ['any', 'vm', 'dartium', 'dart2js', 'frog' ] |