| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 # Copyright (c) 2013, 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 a build of the editor. | 7 # A script which will be invoked from gyp to create a build of the editor. |
| 8 # | 8 # |
| 9 # Usage: ./tools/create_editor.py | 9 # Usage: ./tools/create_editor.py |
| 10 # [--mode <mode>] [--arch <arch>] [--out <output>] [--build <build>] | 10 # [--mode <mode>] [--arch <arch>] [--out <output>] [--build <build>] |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 def AntPath(): | 40 def AntPath(): |
| 41 parent = join('third_party', 'apache_ant', '1.8.4', 'bin') | 41 parent = join('third_party', 'apache_ant', '1.8.4', 'bin') |
| 42 if utils.IsWindows(): | 42 if utils.IsWindows(): |
| 43 return join(parent, 'ant.bat') | 43 return join(parent, 'ant.bat') |
| 44 else: | 44 else: |
| 45 return join(parent, 'ant') | 45 return join(parent, 'ant') |
| 46 | 46 |
| 47 | 47 |
| 48 def ProcessEditorArchive(archive, outDir): | 48 def ProcessEditorArchive(archive, outDir): |
| 49 tempDir = join(GetEditorTemp(), 'editor.out') | 49 tempDir = join(GetEditorTemp(), 'editor.out') |
| 50 os.makedirs(tempDir) | 50 try: |
| 51 os.makedirs(tempDir) |
| 52 except OSError: |
| 53 # Directory already exists. |
| 54 pass |
| 51 | 55 |
| 52 if utils.IsWindows(): | 56 if utils.IsWindows(): |
| 53 f = zipfile.ZipFile(archive) | 57 f = zipfile.ZipFile(archive) |
| 54 f.extractall(tempDir) | 58 f.extractall(tempDir) |
| 59 f.close() |
| 55 else: | 60 else: |
| 56 subprocess.call(['unzip', '-q', archive, '-d', tempDir]) | 61 subprocess.call(['unzip', '-q', archive, '-d', tempDir]) |
| 57 | 62 |
| 58 for src in glob.glob(join(tempDir, 'dart', '*')): | 63 for src in glob.glob(join(tempDir, 'dart', '*')): |
| 59 shutil.move(src, outDir) | 64 shutil.move(src, outDir) |
| 60 | 65 |
| 61 shutil.rmtree(tempDir) | 66 shutil.rmtree(tempDir) |
| 62 os.unlink(archive) | 67 os.unlink(archive) |
| 63 | 68 |
| 64 | 69 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 ProcessEditorArchive(archives[0], OUTPUT) | 191 ProcessEditorArchive(archives[0], OUTPUT) |
| 187 | 192 |
| 188 if os.path.exists(GetEditorTemp()): | 193 if os.path.exists(GetEditorTemp()): |
| 189 shutil.rmtree(GetEditorTemp()) | 194 shutil.rmtree(GetEditorTemp()) |
| 190 | 195 |
| 191 print('\nEditor build successful') | 196 print('\nEditor build successful') |
| 192 | 197 |
| 193 | 198 |
| 194 if __name__ == '__main__': | 199 if __name__ == '__main__': |
| 195 sys.exit(Main()) | 200 sys.exit(Main()) |
| OLD | NEW |