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

Side by Side Diff: mojo/public/tools/dart_pub_get.py

Issue 1063233004: Teach dart_package to understand the packages/ subdirectory (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Remove dart-packages Created 5 years, 8 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
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright 2015 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # This script runs "pub get" on a given directory and outputs the filenames of
tonyg 2015/04/08 13:52:38 This looks like a module-level docstring, """Lorem
blundell 2015/04/09 11:53:41 Done.
7 # the files that are thus pulled in relative to that given directory.
tonyg 2015/04/08 13:52:38 I think a link to documentation would be helpful i
blundell 2015/04/09 11:53:41 Done.
8 #
9 # The first argument should be the parent directory of the Dart SDK relative to
10 # the directory in which this script is being run.
11 # The second argument should be the directory on which to run "pub get" relative
12 # to the directory in which this script is being run.
13
14 import os
15 import subprocess
16 import sys
17
18 def main(args):
19 dart_sdk_root = args[0]
tonyg 2015/04/08 13:52:38 This is a nit, but I'd recommend using argparse in
blundell 2015/04/09 11:53:41 Done.
20 target_directory = args[1]
21 cmd = [
22 os.path.join(os.getcwd(), dart_sdk_root, "dart-sdk/bin/pub")
tonyg 2015/04/08 13:52:38 I could be mistaken, but I don't think os.getcwd()
blundell 2015/04/09 11:53:41 Done.
23 ]
24 cmd.extend(["get"])
25
26 os.chdir(target_directory)
27 subprocess.check_output(cmd, shell=False, stderr=subprocess.STDOUT)
tonyg 2015/04/08 13:52:38 Cleaner to pass cwd=target_dir rather than than do
blundell 2015/04/09 11:53:41 Done.
28
29 for root, _, files in os.walk("packages", followlinks=True):
30 for f in files:
31 print os.path.join(root, f)
32
33 if __name__ == '__main__':
34 sys.exit(main(sys.argv[1:]))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698