| 1 | #!/usr/bin/python |
|---|
| 2 | |
|---|
| 3 | import sys, os |
|---|
| 4 | |
|---|
| 5 | filePath = sys.argv[1] |
|---|
| 6 | f = open(filePath, 'rU') |
|---|
| 7 | |
|---|
| 8 | print 'Parsing: %s' % filePath |
|---|
| 9 | |
|---|
| 10 | for r in f: |
|---|
| 11 | line = r.lstrip(' ').rstrip('\n') |
|---|
| 12 | start = line.find('test_') |
|---|
| 13 | end = start + line[start:].find('.') |
|---|
| 14 | path = line[:start].replace('.', os.path.sep) |
|---|
| 15 | |
|---|
| 16 | if end <= start: |
|---|
| 17 | fname = line[start:] |
|---|
| 18 | else: |
|---|
| 19 | fname = line[start:end] |
|---|
| 20 | |
|---|
| 21 | fname += '.py' |
|---|
| 22 | relpath = '%s%s' % (path, fname) |
|---|
| 23 | |
|---|
| 24 | print '\nModule: %s' % line |
|---|
| 25 | |
|---|
| 26 | if os.path.exists(relpath): |
|---|
| 27 | abspath = os.path.abspath(relpath) |
|---|
| 28 | print 'Relative path: %s' % relpath |
|---|
| 29 | print 'Absolute path: %s' % abspath |
|---|
| 30 | |
|---|
| 31 | os.system('epydoc %s -v --simple-term' % abspath) |
|---|
| 32 | |
|---|
| 33 | print '-' * 100 |
|---|
| 34 | |
|---|
| 35 | nxt = raw_input("Type 'y' to open this file or Enter to skip it: ") |
|---|
| 36 | |
|---|
| 37 | if nxt == 'y': |
|---|
| 38 | os.system('open ' + abspath) |
|---|
| 39 | else: |
|---|
| 40 | print 'Error for %s' % relpath |
|---|
| 41 | print '=' * 80 |
|---|