Chris@39: import os Chris@39: import os.path Chris@39: import string Chris@39: Chris@39: paRootDirectory = '../../' Chris@39: paHtmlDocDirectory = os.path.join( paRootDirectory, "doc", "html" ) Chris@39: Chris@39: ## Script to check documentation status Chris@39: ## this script assumes that html doxygen documentation has been generated Chris@39: ## Chris@39: ## it then walks the entire portaudio source tree and check that Chris@39: ## - every source file (.c,.h,.cpp) has a doxygen comment block containing Chris@39: ## - a @file directive Chris@39: ## - a @brief directive Chris@39: ## - a @ingroup directive Chris@39: ## - it also checks that a corresponding html documentation file has been generated. Chris@39: ## Chris@39: ## This can be used as a first-level check to make sure the documentation is in order. Chris@39: ## Chris@39: ## The idea is to get a list of which files are missing doxygen documentation. Chris@39: Chris@39: Chris@39: # recurse from top and return a list of all with the given Chris@39: # extensions. ignore .svn directories. return absolute paths Chris@39: def recursiveFindFiles( top, extensions, includePaths ): Chris@39: result = [] Chris@39: for (dirpath, dirnames, filenames) in os.walk(top): Chris@39: if not '.svn' in dirpath: Chris@39: for f in filenames: Chris@39: if os.path.splitext(f)[1] in extensions: Chris@39: if includePaths: Chris@39: result.append( os.path.abspath( os.path.join( dirpath, f ) ) ) Chris@39: else: Chris@39: result.append( f ) Chris@39: return result Chris@39: Chris@39: # generate the html file name that doxygen would use for Chris@39: # a particular source file. this is a brittle conversion Chris@39: # which i worked out by trial and error Chris@39: def doxygenHtmlDocFileName( sourceFile ): Chris@39: return sourceFile.replace( '_', '__' ).replace( '.', '_8' ) + '.html' Chris@39: Chris@39: Chris@39: sourceFiles = recursiveFindFiles( paRootDirectory, [ '.c', '.h', '.cpp' ], True ); Chris@39: docFiles = recursiveFindFiles( paHtmlDocDirectory, [ '.html' ], False ); Chris@39: Chris@39: Chris@39: Chris@39: currentFile = "" Chris@39: Chris@39: def printError( f, message ): Chris@39: global currentFile Chris@39: if f != currentFile: Chris@39: currentFile = f Chris@39: print f, ":" Chris@39: print "\t!", message Chris@39: Chris@39: Chris@39: for f in sourceFiles: Chris@39: if not doxygenHtmlDocFileName( os.path.basename(f) ) in docFiles: Chris@39: printError( f, "no doxygen generated doc page" ) Chris@39: Chris@39: s = file( f, 'rt' ).read() Chris@39: Chris@39: if not '/**' in s: Chris@39: printError( f, "no doxygen /** block" ) Chris@39: Chris@39: if not '@file' in s: Chris@39: printError( f, "no doxygen @file tag" ) Chris@39: Chris@39: if not '@brief' in s: Chris@39: printError( f, "no doxygen @brief tag" ) Chris@39: Chris@39: if not '@ingroup' in s: Chris@39: printError( f, "no doxygen @ingroup tag" ) Chris@39: Chris@39: