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

Side by Side Diff: mojo/public/tools/bindings/pylib/mojom_tests/parse/run_parser.py

Issue 443293003: Mojo: Add PRESUBMIT.py to mojo/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Simple testing utility to just run the mojom parser.""" 6 """Simple testing utility to just run the mojom parser."""
7 7
8 8
9 import os.path 9 import os.path
10 import sys 10 import sys
11 11
12 sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), 12 sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)),
13 os.path.pardir, os.path.pardir)) 13 os.path.pardir, os.path.pardir))
14 14
15 # Disable lint check for finding modules:
16 # pylint: disable=F0401
17
18 from mojom.parse.parser import Parse, ParseError 15 from mojom.parse.parser import Parse, ParseError
19 16
20 17
21 def main(argv): 18 def main(argv):
22 if len(argv) < 2: 19 if len(argv) < 2:
23 print "usage: %s filename" % argv[0] 20 print "usage: %s filename" % argv[0]
24 return 0 21 return 0
25 22
26 for filename in argv[1:]: 23 for filename in argv[1:]:
27 with open(filename) as f: 24 with open(filename) as f:
28 print "%s:" % filename 25 print "%s:" % filename
29 try: 26 try:
30 print Parse(f.read(), filename) 27 print Parse(f.read(), filename)
31 except ParseError, e: 28 except ParseError, e:
32 print e 29 print e
33 return 1 30 return 1
34 31
35 return 0 32 return 0
36 33
37 34
38 if __name__ == '__main__': 35 if __name__ == '__main__':
39 sys.exit(main(sys.argv)) 36 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698