#NEWLINE# def make_doc( ) : #NEWLINE# #INDENT# with lcd ( 'docs' ) : #NEWLINE# #INDENT# local ( 'sphinx-apidoc -o . -f ../custodian' ) #NEWLINE# local ( 'rm custodian*.tests.rst' ) #NEWLINE# for f in glob . glob ( 'docs/*.rst' ) : #NEWLINE# #INDENT# if ( f . startswith ( 'docs/custodian' ) and f . endswith ( 'rst' ) ) : #NEWLINE# #INDENT# newoutput = [ ] #NEWLINE# suboutput = [ ] #NEWLINE# subpackage = False #NEWLINE# with open ( f , 'r' ) as fid : #NEWLINE# #INDENT# for line in fid : #NEWLINE# #INDENT# clean = line . strip ( ) #NEWLINE# if ( clean == 'Subpackages' ) : #NEWLINE# #INDENT# subpackage = True #NEWLINE# #UNINDENT# if ( ( not subpackage ) and ( not clean . endswith ( 'tests' ) ) ) : #NEWLINE# #INDENT# newoutput . append ( line ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( not clean . endswith ( 'tests' ) ) : #NEWLINE# #INDENT# suboutput . append ( line ) #NEWLINE# #UNINDENT# if ( clean . startswith ( 'custodian' ) and ( not clean . endswith ( 'tests' ) ) ) : #NEWLINE# #INDENT# newoutput . extend ( suboutput ) #NEWLINE# subpackage = False #NEWLINE# suboutput = [ ] #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# with open ( f , 'w' ) as fid : #NEWLINE# #INDENT# fid . write ( '' . join ( clean ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# local ( 'make html' )