38 lines
844 B
Python
Executable File
38 lines
844 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
import sys
|
|
|
|
excludes = ['istats_diff.py']
|
|
|
|
filename = sys.argv[1]
|
|
|
|
if filename.endswith('__init__.py'):
|
|
sys.exit(0)
|
|
|
|
for e in excludes:
|
|
if filename.endswith(e):
|
|
sys.stderr.write('\tSkip %s\n' % (filename))
|
|
sys.exit(0)
|
|
|
|
package_name = filename.replace('/', '.').replace('.py', '')
|
|
sys.stdout.write('%s' % (package_name))
|
|
sys.stdout.write('\n')
|
|
# sys.stdout.write('\n\n')
|
|
sys.stdout.write('-' * len(package_name))
|
|
sys.stdout.write('\n\n')
|
|
|
|
sys.stderr.write('\tExtract doc from %s\n' % (filename))
|
|
|
|
with open(filename) as infile:
|
|
copy = False
|
|
for line in infile:
|
|
if line.strip() in ['"""', "'''"]:
|
|
if not copy:
|
|
copy = True
|
|
else:
|
|
break
|
|
elif copy:
|
|
sys.stdout.write(' %s' % (line))
|
|
|
|
sys.stdout.write('\n\n')
|