OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
5 """Helper for building and deploying Observatory""" | 5 """Helper for building and deploying Observatory""" |
6 | 6 |
7 import argparse | 7 import argparse |
8 import os | 8 import os |
9 import platform | 9 import platform |
10 import shutil | 10 import shutil |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 if pub_executable is not None: | 127 if pub_executable is not None: |
128 executable = [pub_executable] | 128 executable = [pub_executable] |
129 elif pub_snapshot is not None: | 129 elif pub_snapshot is not None: |
130 executable = [utils.CheckedInSdkExecutable(), pub_snapshot] | 130 executable = [utils.CheckedInSdkExecutable(), pub_snapshot] |
131 else: | 131 else: |
132 DisplayBootstrapWarning() | 132 DisplayBootstrapWarning() |
133 executable = [dart_executable, '--package-root=' + pkg_root, PUB_PATH] | 133 executable = [dart_executable, '--package-root=' + pkg_root, PUB_PATH] |
134 # Prevent the bootstrap Dart executable from running in regular | 134 # Prevent the bootstrap Dart executable from running in regular |
135 # development flow. | 135 # development flow. |
136 # REMOVE THE FOLLOWING LINE TO USE the dart_bootstrap binary. | 136 # REMOVE THE FOLLOWING LINE TO USE the dart_bootstrap binary. |
137 return False | 137 # return False |
138 return subprocess.call(executable + command, | 138 return subprocess.call(executable + command, |
139 stdout=silent_sink if silent else None, | 139 stdout=silent_sink if silent else None, |
140 stderr=silent_sink if silent else None) | 140 stderr=silent_sink if silent else None) |
141 | 141 |
142 def Deploy(input_dir, output_dir): | 142 def Deploy(input_dir, output_dir): |
143 shutil.rmtree(output_dir) | 143 shutil.rmtree(output_dir) |
144 shutil.copytree(input_dir, output_dir, ignore=IGNORE_PATTERNS) | 144 shutil.copytree(input_dir, output_dir, ignore=IGNORE_PATTERNS) |
145 index_file = os.path.join(output_dir, 'web', 'index.html') | 145 index_file = os.path.join(output_dir, 'web', 'index.html') |
146 os.utime(index_file, None) | 146 os.utime(index_file, None) |
147 return 0 | 147 return 0 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (options.pub_snapshot != None): | 201 if (options.pub_snapshot != None): |
202 options.pub_snapshot = os.path.abspath(options.pub_snapshot) | 202 options.pub_snapshot = os.path.abspath(options.pub_snapshot) |
203 if len(args) == 1: | 203 if len(args) == 1: |
204 args[0] = os.path.abspath(args[0]) | 204 args[0] = os.path.abspath(args[0]) |
205 # Pub must be run from the project's root directory. | 205 # Pub must be run from the project's root directory. |
206 ChangeDirectory(options.directory) | 206 ChangeDirectory(options.directory) |
207 return ExecuteCommand(options, args) | 207 return ExecuteCommand(options, args) |
208 | 208 |
209 if __name__ == '__main__': | 209 if __name__ == '__main__': |
210 sys.exit(main()); | 210 sys.exit(main()); |
OLD | NEW |