~ubuntu-branches/ubuntu/gutsy/audacity/gutsy

« back to all changes in this revision

Viewing changes to lib-src/portaudio-v19/doc/utils/checkfiledocs.py

  • Committer: Bazaar Package Importer
  • Author(s): Free Ekanayaka
  • Date: 2007-05-17 02:36:41 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070517023641-5yjqt9434cbcb6ph
Tags: 1.3.2-4
* debian/patches:
   - desktop_file.patch: fixed broken Category entry
* debian/audacity.mime:
   - added entry for application/x-audacity-project

Show diffs side-by-side

added added

removed removed

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