Move Python script over to Dart.

This commit is contained in:
Nathan Kerr
2015-11-10 12:31:29 -08:00
parent 0a1385d9a9
commit 9d016b7c10
3 changed files with 22 additions and 21 deletions

21
dev/update_packages.dart Normal file
View File

@@ -0,0 +1,21 @@
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:io';
final String binaryName = Platform.isWindows ? 'pub.bat' : 'pub';
update(Directory directory) {
for (FileSystemEntity dir in directory.listSync()) {
if (dir is Directory) {
print("Updating ${dir.path}...");
Process.runSync(binaryName, ['get'], workingDirectory: dir.path);
}
}
}
main() {
String FLUTTER_ROOT = new File(Platform.script.toFilePath()).parent.parent.path;
update(new Directory("$FLUTTER_ROOT/packages"));
update(new Directory("$FLUTTER_ROOT/examples"));
}

View File

@@ -1,20 +0,0 @@
#!/usr/bin/env python
# Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
FLUTTER_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
def update(directory):
packages = sorted(os.listdir(directory))
for package in packages:
package_dir = os.path.join(directory, package)
if os.path.isdir(package_dir):
print 'Updating', package, '...'
subprocess.check_call(['pub', 'get'], cwd=package_dir)
update(os.path.join(FLUTTER_ROOT, 'packages'))
update(os.path.join(FLUTTER_ROOT, 'examples'))