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