45
45
raw_input('If everything is correct, please press enter to compile ' +
48
# To make things portable we need to get the relative path from the MAUS dir
49
# to the third party dir, as we do in generate_doc_index.py
50
paths = [maus_thirdparty, maus_rootdir]
51
tppath_segment = paths[0][len(commonprefix(paths))+1:]
52
maus_path_segment = paths[1][len(commonprefix(paths))+1:]
53
# Need to deal with the case where the two paths are the same
54
if tppath_segment == maus_path_segment:
56
# Generate the appropriate paths to link to the third party libaries.
58
rel_tppath = tppath_segment + '/doc/'
59
dir_prepend = '../'*(maus_path_segment.count('/')+2)
60
rel_tppath = dir_prepend + rel_tppath
48
62
# A list of all tagfiles with doc location. MAUS component tagfiles are
49
63
# added one by one as they are created.
50
tagfiles_dict = dict((i, maus_thirdparty + '/doc/doxygen_' + i + '/' + i +
51
'.tag=' + maus_thirdparty + '/doc/doxygen_' + i +
64
tagfiles_dict = dict((i, '../' + rel_tppath + 'doxygen_' + i + '/' + i +
65
'.tag=' + '../../' + rel_tppath + 'doxygen_' + i +
52
66
'/html') for i in thirdpartylibs)
53
tagfilesmaus_dict = dict((i, maus_rootdir + '/doc/doxygen_' + i + '/' + i +
54
'.tag=' + maus_rootdir + '/doc/doxygen_' + i +
67
tagfilesmaus_dict = dict((i, '../doxygen_' + i + '/' + i +
68
'.tag=' + '../../doxygen_' + i +
55
69
'/html') for i in maus_components)
56
70
tagfiles = ' '.join(tagfiles_dict.values())
97
110
def run_doxygen_framework(tagfiles):
98
111
"""Run doxygen for the MAUS framework"""
99
script = """( cat ${MAUS_ROOT_DIR}/doc/doc_tools/Doxyfile.general ;
112
script = """( cat Doxyfile.general ;
100
113
echo 'PROJECT_NAME = "MAUS-framework"';
101
echo INPUT = ${MAUS_ROOT_DIR}/src/common_*/ ${MAUS_ROOT_DIR}/src/py_cpp/ ${MAUS_ROOT_DIR}/src/legacy/;
102
echo OUTPUT_DIRECTORY = ${MAUS_ROOT_DIR}/doc/doxygen_framework/;
114
echo INPUT = ../../src/common_*/ ../../src/py_cpp/ ../../src/legacy/;
115
echo OUTPUT_DIRECTORY = ../doxygen_framework/;
103
116
echo TAGFILES = $0;
104
117
echo QUIET = YES;
105
118
echo EXCLUDE_PATTERNS = */DataStructure/*;
106
echo GENERATE_TAGFILE = ${MAUS_ROOT_DIR}/doc/doxygen_framework/framework.tag ) | doxygen -
119
echo GENERATE_TAGFILE = ../doxygen_framework/framework.tag ) | doxygen -
108
121
subprocess.call([script, str(tagfiles)], shell=True)
111
124
def run_doxygen_datastructure(tagfiles):
112
125
"""Run doxygen for the MAUS DataStructure"""
113
script = """( cat ${MAUS_ROOT_DIR}/doc/doc_tools/Doxyfile.general ;
126
script = """( cat Doxyfile.general ;
114
127
echo 'PROJECT_NAME = "MAUS-datastructure"';
115
echo INPUT = ${MAUS_ROOT_DIR}/src/common_cpp/DataStructure/;
116
echo OUTPUT_DIRECTORY = ${MAUS_ROOT_DIR}/doc/doxygen_datastructure/;
128
echo INPUT = ../../src/common_cpp/DataStructure/;
129
echo OUTPUT_DIRECTORY = ../doxygen_datastructure/;
117
130
echo TAGFILES = $0;
118
131
echo QUIET = YES;
119
132
echo EXCLUDE_PATTERNS = *MausDataStructure.*
120
echo GENERATE_TAGFILE = ${MAUS_ROOT_DIR}/doc/doxygen_datastructure/datastructure.tag ) | doxygen -
133
echo GENERATE_TAGFILE = ../doxygen_datastructure/datastructure.tag ) | doxygen -
122
135
subprocess.call([script, str(tagfiles)], shell=True)
125
138
def run_doxygen(component, tagfiles):
126
139
"""Run doxygen for other MAUS components"""
127
script = """( cat ${MAUS_ROOT_DIR}/doc/doc_tools/Doxyfile.general ;
140
script = """( cat Doxyfile.general ;
128
141
echo PROJECT_NAME = MAUS-$0;
129
echo INPUT = ${MAUS_ROOT_DIR}/src/$0/;
130
echo OUTPUT_DIRECTORY = ${MAUS_ROOT_DIR}/doc/doxygen_$0/;
142
echo INPUT = ../../src/$0/;
143
echo OUTPUT_DIRECTORY = ../doxygen_$0/;
131
144
echo TAGFILES = $1;
132
145
echo QUIET = YES;
133
echo GENERATE_TAGFILE = ${MAUS_ROOT_DIR}/doc/doxygen_$0/$0.tag ) | doxygen -
146
echo GENERATE_TAGFILE = ../doxygen_$0/$0.tag ) | doxygen -
135
148
subprocess.call([script, str(component), str(tagfiles)], shell=True)
137
def fix_doxygen_paths():
138
"""Fix relative paths in doxygen search scripts"""
139
# Note that there may be a simpler way to do this with the doxy config
140
# however I have not been able to get that to work, hence this hack
142
# go through all doxygen generated components
143
doxy_comps = ['root', 'geant4', 'clhep', 'jsoncpp', \
144
'framework', 'datastructure', 'input', 'map', 'reduce', \
146
for component in doxy_comps:
147
doxdir = 'doxygen_' + component
148
# find the directory with the javascripts
149
replace_in = os.path.expandvars("${MAUS_ROOT_DIR}")
150
replace_out = '/maus/MAUS_latest_version'
151
jsdir = os.path.join(os.environ['MAUS_ROOT_DIR'], \
152
'doc', doxdir, 'html', 'search')
154
for inputFile in glob.glob("*.js"):
155
# open a tmp file to write the modified lines into
156
tmpOut = inputFile + '.tmp'
157
tmpFd = open(tmpOut, "w")
158
# open the input js file
159
inputFd = open(inputFile)
162
tmpFd.write(re.sub(replace_in, replace_out, line))
163
# close the tmp file and rename it
165
os.rename(tmpOut, inputFile)
150
def commonprefix(*args):
151
"""Fix behaviour of commonprefix function"""
152
return os.path.commonprefix(*args).rpartition('/')[0]
166
154
if __name__ == "__main__":