annotate src/portaudio_20140130/doc/utils/checkfiledocs.py @ 169:223a55898ab9 tip default

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