annotate src/portaudio_20140130/doc/utils/checkfiledocs.py @ 39:7ddb4fc30dac

Current stable PortAudio source
author Chris Cannam
date Tue, 18 Oct 2016 13:11:05 +0100
parents
children
rev   line source
Chris@39 1 import os
Chris@39 2 import os.path
Chris@39 3 import string
Chris@39 4
Chris@39 5 paRootDirectory = '../../'
Chris@39 6 paHtmlDocDirectory = os.path.join( paRootDirectory, "doc", "html" )
Chris@39 7
Chris@39 8 ## Script to check documentation status
Chris@39 9 ## this script assumes that html doxygen documentation has been generated
Chris@39 10 ##
Chris@39 11 ## it then walks the entire portaudio source tree and check that
Chris@39 12 ## - every source file (.c,.h,.cpp) has a doxygen comment block containing
Chris@39 13 ## - a @file directive
Chris@39 14 ## - a @brief directive
Chris@39 15 ## - a @ingroup directive
Chris@39 16 ## - it also checks that a corresponding html documentation file has been generated.
Chris@39 17 ##
Chris@39 18 ## This can be used as a first-level check to make sure the documentation is in order.
Chris@39 19 ##
Chris@39 20 ## The idea is to get a list of which files are missing doxygen documentation.
Chris@39 21
Chris@39 22
Chris@39 23 # recurse from top and return a list of all with the given
Chris@39 24 # extensions. ignore .svn directories. return absolute paths
Chris@39 25 def recursiveFindFiles( top, extensions, includePaths ):
Chris@39 26 result = []
Chris@39 27 for (dirpath, dirnames, filenames) in os.walk(top):
Chris@39 28 if not '.svn' in dirpath:
Chris@39 29 for f in filenames:
Chris@39 30 if os.path.splitext(f)[1] in extensions:
Chris@39 31 if includePaths:
Chris@39 32 result.append( os.path.abspath( os.path.join( dirpath, f ) ) )
Chris@39 33 else:
Chris@39 34 result.append( f )
Chris@39 35 return result
Chris@39 36
Chris@39 37 # generate the html file name that doxygen would use for
Chris@39 38 # a particular source file. this is a brittle conversion
Chris@39 39 # which i worked out by trial and error
Chris@39 40 def doxygenHtmlDocFileName( sourceFile ):
Chris@39 41 return sourceFile.replace( '_', '__' ).replace( '.', '_8' ) + '.html'
Chris@39 42
Chris@39 43
Chris@39 44 sourceFiles = recursiveFindFiles( paRootDirectory, [ '.c', '.h', '.cpp' ], True );
Chris@39 45 docFiles = recursiveFindFiles( paHtmlDocDirectory, [ '.html' ], False );
Chris@39 46
Chris@39 47
Chris@39 48
Chris@39 49 currentFile = ""
Chris@39 50
Chris@39 51 def printError( f, message ):
Chris@39 52 global currentFile
Chris@39 53 if f != currentFile:
Chris@39 54 currentFile = f
Chris@39 55 print f, ":"
Chris@39 56 print "\t!", message
Chris@39 57
Chris@39 58
Chris@39 59 for f in sourceFiles:
Chris@39 60 if not doxygenHtmlDocFileName( os.path.basename(f) ) in docFiles:
Chris@39 61 printError( f, "no doxygen generated doc page" )
Chris@39 62
Chris@39 63 s = file( f, 'rt' ).read()
Chris@39 64
Chris@39 65 if not '/**' in s:
Chris@39 66 printError( f, "no doxygen /** block" )
Chris@39 67
Chris@39 68 if not '@file' in s:
Chris@39 69 printError( f, "no doxygen @file tag" )
Chris@39 70
Chris@39 71 if not '@brief' in s:
Chris@39 72 printError( f, "no doxygen @brief tag" )
Chris@39 73
Chris@39 74 if not '@ingroup' in s:
Chris@39 75 printError( f, "no doxygen @ingroup tag" )
Chris@39 76
Chris@39 77