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

Unified Diff: third_party/mojo/src/mojo/public/tools/dart_package_name.py

Issue 1157843002: Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/mojo/src/mojo/public/tools/dart_package_name.py
diff --git a/third_party/mojo/src/mojo/public/tools/dart_package_name.py b/third_party/mojo/src/mojo/public/tools/dart_package_name.py
new file mode 100755
index 0000000000000000000000000000000000000000..5817945e49cba2b316bd085ea2529366d2ce4eb7
--- /dev/null
+++ b/third_party/mojo/src/mojo/public/tools/dart_package_name.py
@@ -0,0 +1,38 @@
+#!/usr/bin/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.
+
+"""This script outputs the package name specified in the pubspec.yaml"""
+
+import argparse
+import os
+import sys
+
+# TODO(johnmccutchan): Use the yaml package to parse.
+def PackageName(line):
+ assert line.startswith("name:")
+ return line.split(":")[1].strip()
+
+def main(pubspec_file):
+ source_file = open(pubspec_file, "r")
+ for line in source_file:
+ if line.startswith("name:"):
+ print(PackageName(line))
+ return 0
+ source_file.close()
+ # Couldn't find it.
+ return -1
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser(
+ description="This script outputs the package name specified in the"
+ "pubspec.yaml")
+ parser.add_argument("--pubspec",
+ dest="pubspec_file",
+ metavar="<pubspec-file>",
+ type=str,
+ required=True,
+ help="Path to pubspec file")
+ args = parser.parse_args()
+ sys.exit(main(args.pubspec_file))
« no previous file with comments | « third_party/mojo/src/mojo/public/tools/dart_package.py ('k') | third_party/mojo/src/mojo/public/tools/dart_pkg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698