Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: mojo/public/dart/tools/fetch_dart_packages.py

Issue 1364463006: Make Python not support "all or none" for two-phase data pipe read/write. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mojo/public/python/mojo_system.pyx » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright 2015 The Chromium Authors. All rights reserved. 3 # Copyright 2015 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """Utility for updating third_party packages used in the Mojo Dart SDK""" 7 """Utility for updating third_party packages used in the Mojo Dart SDK"""
8 8
9 import argparse 9 import argparse
10 import errno 10 import errno
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 print('Copying %s to %s' % (package_path, destinaton_path)) 48 print('Copying %s to %s' % (package_path, destinaton_path))
49 shutil.copytree(package_path, destinaton_path) 49 shutil.copytree(package_path, destinaton_path)
50 50
51 def cleanup(base_path): 51 def cleanup(base_path):
52 shutil.rmtree(os.path.join(base_path, 'packages'), True) 52 shutil.rmtree(os.path.join(base_path, 'packages'), True)
53 shutil.rmtree(os.path.join(base_path, '.pub'), True) 53 shutil.rmtree(os.path.join(base_path, '.pub'), True)
54 os.remove(os.path.join(base_path, '.packages')) 54 os.remove(os.path.join(base_path, '.packages'))
55 55
56 def main(): 56 def main():
57 parser = argparse.ArgumentParser(description='Update third_party packages') 57 parser = argparse.ArgumentParser(description='Update third_party packages')
58 parser.add_argument('--pub-exe', 58 parser.add_argument(
59 action='store', 59 '--pub-exe',
60 metavar='pub_exe', 60 action='store',
61 help='Path to the pub executable', 61 metavar='pub_exe',
62 default='../../../../third_party/dart-sdk/dart-sdk/bin/pub ') 62 help='Path to the pub executable',
63 default='../../../../third_party/dart-sdk/dart-sdk/bin/pub')
63 parser.add_argument('--directory', 64 parser.add_argument('--directory',
64 action='store', 65 action='store',
65 metavar='directory', 66 metavar='directory',
66 help='Directory containing pubspec.yaml', 67 help='Directory containing pubspec.yaml',
67 default='.') 68 default='.')
68 parser.add_argument('--list', 69 parser.add_argument('--list',
69 help='List mode', 70 help='List mode',
70 action='store_true', 71 action='store_true',
71 default=False) 72 default=False)
72 args = parser.parse_args() 73 args = parser.parse_args()
73 args.directory = os.path.abspath(args.directory) 74 args.directory = os.path.abspath(args.directory)
74 75
75 if not check_for_pubspec_yaml(args.directory): 76 if not check_for_pubspec_yaml(args.directory):
76 print('Error could not find pubspec.yaml') 77 print('Error could not find pubspec.yaml')
77 return 1 78 return 1
78 79
79 if args.list: 80 if args.list:
80 list_packages(args.directory) 81 list_packages(args.directory)
81 else: 82 else:
82 remove_existing_packages(args.directory) 83 remove_existing_packages(args.directory)
83 change_directory(args.directory) 84 change_directory(args.directory)
84 print('Running pub get') 85 print('Running pub get')
85 pub_get(args.pub_exe) 86 pub_get(args.pub_exe)
86 copy_packages(args.directory) 87 copy_packages(args.directory)
87 print('Cleaning up') 88 print('Cleaning up')
88 cleanup(args.directory) 89 cleanup(args.directory)
89 90
90 if __name__ == '__main__': 91 if __name__ == '__main__':
91 sys.exit(main()) 92 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | mojo/public/python/mojo_system.pyx » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698