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