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: tools/testing/legpad/legpad.py

Issue 9958048: display line count in legpad (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 8 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 2
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 6
7 """ 7 """
8 Legpad is used to compile .dart files to javascript, using the dart2js compiler. 8 Legpad is used to compile .dart files to javascript, using the dart2js compiler.
9 9
10 This is accomplished by creating an html file (usually called 10 This is accomplished by creating an html file (usually called
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 hold the contents of this file. 279 hold the contents of this file.
280 """ 280 """
281 return self.shorten(name).replace("/", "_").replace(".", "_") 281 return self.shorten(name).replace("/", "_").replace(".", "_")
282 282
283 283
284 class File(object): 284 class File(object):
285 def __init__(self, pad, name): 285 def __init__(self, pad, name):
286 self.pad = pad 286 self.pad = pad
287 self.name = name 287 self.name = name
288 self.id = pad.make_id(name) 288 self.id = pad.make_id(name)
289 check_exists(name) 289 self.contents = read_file(name)
290 with open(self.name, "r") as f:
291 self.contents = f.read()
292 290
293 def directives(self): 291 def directives(self):
294 """Load files referenced by #source, #import and #native directives.""" 292 """Load files referenced by #source, #import and #native directives."""
295 lines = self.contents.split("\n") 293 lines = self.contents.split("\n")
296 self.line_number = 0 294 self.line_number = 0
297 for line in lines: 295 for line in lines:
298 self.line_number += 1 296 self.line_number += 1
299 self._directive(line) 297 self._directive(line)
300 298
301 def _directive(self, line): 299 def _directive(self, line):
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 raise CommandFailedException(msg) 357 raise CommandFailedException(msg)
360 logging.debug("SUCCEEDED (%d bytes)" % len(stdout)) 358 logging.debug("SUCCEEDED (%d bytes)" % len(stdout))
361 return stdout 359 return stdout
362 360
363 361
364 def main(argv): 362 def main(argv):
365 Pad(argv) 363 Pad(argv)
366 364
367 if __name__ == "__main__": 365 if __name__ == "__main__":
368 sys.exit(main(sys.argv)) 366 sys.exit(main(sys.argv))
OLDNEW
« tools/testing/legpad/legpad.dart ('K') | « tools/testing/legpad/legpad.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698