OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # | 2 # |
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2012, 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 copymode(src, dest) | 94 copymode(src, dest) |
95 | 95 |
96 | 96 |
97 def CopyShellScript(src_file, dest_dir): | 97 def CopyShellScript(src_file, dest_dir): |
98 """Copies a shell/batch script to the given destination directory. Handles | 98 """Copies a shell/batch script to the given destination directory. Handles |
99 using the appropriate platform-specific file extension.""" | 99 using the appropriate platform-specific file extension.""" |
100 file_extension = '' | 100 file_extension = '' |
101 if HOST_OS == 'win32': | 101 if HOST_OS == 'win32': |
102 file_extension = '.bat' | 102 file_extension = '.bat' |
103 | 103 |
| 104 # If we're copying an SDK-specific shell script, strip off the suffix. |
| 105 dest_file = basename(src_file) |
| 106 if dest_file.endswith('_sdk'): |
| 107 dest_file = dest_file.replace('_sdk', '') |
| 108 |
104 src = src_file + file_extension | 109 src = src_file + file_extension |
105 dest = join(dest_dir, basename(src_file) + file_extension) | 110 dest = join(dest_dir, dest_file + file_extension) |
106 Copy(src, dest) | 111 Copy(src, dest) |
107 | 112 |
108 | 113 |
109 def CopyDartScripts(home, sdk_root): | 114 def CopyDartScripts(home, sdk_root): |
110 for executable in ['dart2js', 'dartanalyzer', 'dartfmt', 'docgen', 'pub']: | 115 for executable in ['dart2js', 'dartanalyzer', 'dartfmt', 'docgen', 'pub_sdk']: |
111 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), | 116 CopyShellScript(os.path.join(home, 'sdk', 'bin', executable), |
112 os.path.join(sdk_root, 'bin')) | 117 os.path.join(sdk_root, 'bin')) |
113 | 118 |
114 | 119 |
115 def CopySnapshots(snapshots, sdk_root): | 120 def CopySnapshots(snapshots, sdk_root): |
116 for snapshot in ['analysis_server', 'dart2js', 'dartanalyzer', 'dartfmt', | 121 for snapshot in ['analysis_server', 'dart2js', 'dartanalyzer', 'dartfmt', |
117 'utils_wrapper', 'pub']: | 122 'utils_wrapper', 'pub']: |
118 snapshot += '.dart.snapshot' | 123 snapshot += '.dart.snapshot' |
119 copyfile(join(snapshots, snapshot), | 124 copyfile(join(snapshots, snapshot), |
120 join(sdk_root, 'bin', 'snapshots', snapshot)) | 125 join(sdk_root, 'bin', 'snapshots', snapshot)) |
121 | 126 |
122 | 127 |
123 def Main(): | 128 def Main(): |
124 # Pull in all of the gypi files which will be munged into the sdk. | 129 # Pull in all of the gypi files which will be munged into the sdk. |
125 HOME = dirname(dirname(realpath(__file__))) | 130 HOME = dirname(dirname(realpath(__file__))) |
126 | 131 |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: | 258 with open(os.path.join(SDK_tmp, 'revision'), 'w') as f: |
254 f.write(revision + '\n') | 259 f.write(revision + '\n') |
255 f.close() | 260 f.close() |
256 | 261 |
257 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) | 262 Copy(join(HOME, 'README.dart-sdk'), join(SDK_tmp, 'README')) |
258 | 263 |
259 move(SDK_tmp, SDK) | 264 move(SDK_tmp, SDK) |
260 | 265 |
261 if __name__ == '__main__': | 266 if __name__ == '__main__': |
262 sys.exit(Main()) | 267 sys.exit(Main()) |
OLD | NEW |