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 shutil | 9 import shutil |
10 import subprocess | 10 import subprocess |
(...skipping 26 matching lines...) Expand all Loading... |
37 def ProcessOptions(options, args): | 37 def ProcessOptions(options, args): |
38 return ((options.package_root != None) and | 38 return ((options.package_root != None) and |
39 (options.directory != None) and | 39 (options.directory != None) and |
40 (options.command != None) and | 40 (options.command != None) and |
41 (options.dart_executable != None)) | 41 (options.dart_executable != None)) |
42 | 42 |
43 def ChangeDirectory(directory): | 43 def ChangeDirectory(directory): |
44 os.chdir(directory); | 44 os.chdir(directory); |
45 | 45 |
46 def PubGet(dart_executable, pkg_root): | 46 def PubGet(dart_executable, pkg_root): |
| 47 # Always remove pubspec.lock before running 'pub get'. |
| 48 try: |
| 49 os.remove('pubspec.lock'); |
| 50 except OSError as e: |
| 51 pass |
47 return subprocess.call(['python', | 52 return subprocess.call(['python', |
48 RUN_PUB, | 53 RUN_PUB, |
49 '--package-root=' + pkg_root, | 54 '--package-root=' + pkg_root, |
50 '--dart-executable=' + dart_executable, | 55 '--dart-executable=' + dart_executable, |
51 'get', | 56 'get', |
52 '--offline']) | 57 '--offline']) |
53 | 58 |
54 def PubBuild(dart_executable, pkg_root, output_dir): | 59 def PubBuild(dart_executable, pkg_root, output_dir): |
55 return subprocess.call(['python', | 60 return subprocess.call(['python', |
56 RUN_PUB, | 61 RUN_PUB, |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 options.package_root = os.path.abspath(options.package_root) | 95 options.package_root = os.path.abspath(options.package_root) |
91 options.dart_executable = os.path.abspath(options.dart_executable) | 96 options.dart_executable = os.path.abspath(options.dart_executable) |
92 if len(args) == 1: | 97 if len(args) == 1: |
93 args[0] = os.path.abspath(args[0]) | 98 args[0] = os.path.abspath(args[0]) |
94 # Pub must be run from the project's root directory. | 99 # Pub must be run from the project's root directory. |
95 ChangeDirectory(options.directory) | 100 ChangeDirectory(options.directory) |
96 return ExecuteCommand(options, args) | 101 return ExecuteCommand(options, args) |
97 | 102 |
98 if __name__ == '__main__': | 103 if __name__ == '__main__': |
99 sys.exit(main()); | 104 sys.exit(main()); |
OLD | NEW |