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

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

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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 | « mojo/public/tools/dart_analyze.py ('k') | mojo/public/tools/dart_pkg.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 outputs the package name specified in the pubspec.yaml"""
7
8 import argparse
9 import os
10 import sys
11
12 # TODO(johnmccutchan): Use the yaml package to parse.
13 def PackageName(line):
14 assert line.startswith("name:")
15 return line.split(":")[1].strip()
16
17 def main(pubspec_file):
18 source_file = open(pubspec_file, "r")
19 for line in source_file:
20 if line.startswith("name:"):
21 print(PackageName(line))
22 return 0
23 source_file.close()
24 # Couldn't find it.
25 return -1
26
27 if __name__ == '__main__':
28 parser = argparse.ArgumentParser(
29 description="This script outputs the package name specified in the"
30 "pubspec.yaml")
31 parser.add_argument("--pubspec",
32 dest="pubspec_file",
33 metavar="<pubspec-file>",
34 type=str,
35 required=True,
36 help="Path to pubspec file")
37 args = parser.parse_args()
38 sys.exit(main(args.pubspec_file))
OLDNEW
« no previous file with comments | « mojo/public/tools/dart_analyze.py ('k') | mojo/public/tools/dart_pkg.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698