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

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

Issue 1132063007: Rationalize Dart mojo and sky package structure (Closed) Base URL: https://github.com/domokit/mojo.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 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 outputs the package name specified in the pubspec.yaml"""
7
8 import argparse
9 import os
10 import sys
11
12 def PackageName(line):
13 assert line.startswith("name:")
14 return line.split(":")[1].strip()
15
16 def main(pubspec_file):
17 source_file = open(pubspec_file, "r")
18 for line in source_file:
19 if line.startswith("name:"):
20 print(PackageName(line))
21 return 0
22 source_file.close()
23 # Couldn't find it.
24 return -1
25
26 if __name__ == '__main__':
27 parser = argparse.ArgumentParser(
28 description="This script outputs the package name specified in the"
29 "pubspec.yaml")
30 parser.add_argument("--pubspec",
31 dest="pubspec_file",
32 metavar="<pubspec-file>",
33 type=str,
34 required=True,
35 help="Path to pubspec file")
36 args = parser.parse_args()
37 sys.exit(main(args.pubspec_file))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698