source: trunk/docs/

Last change on this file was 3166, checked in by toby, 4 years ago

Misc Py3 fixes

  • Property svn:eol-style set to native
File size: 1.7 KB
1'''Find Python files in GSASII that are not referenced in the sphinx documentation
3import glob
4import os.path
5import subprocess as sp
7# get list of documented files (misses out on data files -- with no functions or classes)
8import glob
9loc = os.path.split(os.path.realpath(__file__))[0] # where is the documentation?
11# prepare a list of the files that show up in the documentation already
12# look for a reference in the .rst files
13documented = []
14for fil in glob.glob('source/*.rst'):
15    for line in open(fil,'r').readlines():
16        if line.strip().startswith('.. automodule::'):
17            documented.append(line.strip().split('::')[1].strip())
19# old method looks for an html version of the source
20# documented = [os.path.splitext(os.path.split(fil)[1])[0] for
21#               fil in glob.iglob(os.path.join(loc,'build/html/_modules/','*.html'))]
23# loop over python files referenced in subversion
24proc = sp.Popen(["svn","list",
25                 os.path.join(loc,'..'),
26                 os.path.join(loc,'..','exports'),
27                 os.path.join(loc,'..','imports'),
28                 ],stdout=sp.PIPE)
29undoc = []
30for fil in proc.stdout.readlines():
31    fil = fil.strip()
32    #print fil+'...',
33    if os.path.splitext(fil.strip())[1] != ".py": continue
34    if os.path.splitext(os.path.split(fil)[1])[0] in documented:
35        #print fil+' doc'
36        continue
37    else:
38        print(fil+' undocumented')
39        undoc.append(fil)
40# generate code to place in a .rst file
41if undoc:
42    print("\n# place this code somewhere in the .rst files\n#")
43for fil in undoc:
44    print(".. automodule:: "+os.path.splitext(os.path.split(fil)[1])[0])
45    print("    :members: ")
46    print("")
Note: See TracBrowser for help on using the repository browser.