2 Created on Aug 29, 2011
12 import urllib2, os, json
16 cvsBaseUrl =
"http://cmssw.cvs.cern.ch/cgi-bin/cmssw.cgi/CMSSW"
17 baseUrl =
"/cmsdoxygen/"
25 html = os.popen(
"curl \""+url+
"\"")
29 input = input.replace(
"{",
"").
replace(
"}",
"")
30 collections = input.split(
"], ")
32 for collection
in collections:
33 parts = collection.split(
": [")
34 title = parts[0].
replace(
'"',
'')
43 output = os.popen(
"find "+DOC_DIR+
" -wholename '*/class*.html' -not \( -name '*-members.html' \) -print")
44 lines = output.read().
split(
"\n")
48 (head, tail) = os.path.split(line)
49 refmanfiles[tail.replace(
"class",
"").
replace(
".html",
"")] = baseUrl+line[line.find(CMSSW_VERSION):]
53 source = open(DOC_DIR+
"/pages.html",
"r")
54 lines = source.read().split("\n")
58 if (line.find(
"li><a class=\"el\" href=\"") != -1):
59 packageDocLinks.append(line.split(
"\"")[3])
63 cvsLink =
"[ <a target=\"_blank\" href=\""+cvsBaseUrl+
"/"+package+
"/"+subpackage+
"\">cvs</a> ]"
67 for link
in packageDocLinks:
68 if (link.find(package+
"_"+subpackage+
".html") != -1):
69 return "[ <a target=\"_blank\" href=\"../"+link+
"\">packageDoc</a> ]"
76 data =
parseJSON(
'/cmsdoxygen/tcproxy.php?type=packages&release=' + release)
79 subsystems = sorted(data.keys())
81 for subsystem
in subsystems:
83 for packagesub
in data[subsystem]:
84 (package, subpackage) = packagesub.split(
"/")
86 if not package
in tree[subsystem]:
87 tree[subsystem][package] = []
88 tree[subsystem][package].
append(subpackage)
90 return (tree, subsystems)
96 dirList=os.listdir(SRC_DIR +
"/" + package+
"/"+subpackage+
"/interface/")
97 for classfile
in dirList:
98 if classfile.endswith(
".h"):
99 classfile = classfile.replace(
".h",
"")
100 for key
in refmanfiles.keys():
101 if (key.find(classfile) != -1):
102 classfile =
"<a target=\"_blank\" href=\""+refmanfiles[key]+
"\">"+classfile+
"</a>"
105 html +=
"<li>"+classfile+
"</li>"
110 html =
"<ul>"+html+
"</ul>"
118 for package,subpackages
in sorted(tree[branch].items()):
119 branchHTML +=
"<li><span><strong>"+package+
"</strong></span><ul>"
121 for subpackage
in subpackages:
128 branchHTML +=
"</li>"
133 templateFile = SCRIPTS_LOCATION+
"/indexPage/tree_template.html"
135 fileIN = open(templateFile,
"r")
136 treeTemplateHTML = fileIN.read()
140 templateFile = SCRIPTS_LOCATION+"/indexPage/indexpage_template.html"
141 fileIN = open(templateFile,
"r")
142 indexPageTemplateHTML = fileIN.read()
146 return treeTemplateHTML, indexPageTemplateHTML
148 if len(sys.argv) < 3:
149 print "Not enough arguments, try script.py CMSSW_VERSION PROJECT_LOCATION SCRIPT_LOCATION"
152 CMSSW_VERSION = sys.argv[1]
153 PROJECT_LOCATION = sys.argv[2]
154 SCRIPTS_LOCATION = sys.argv[3]
156 SRC_DIR = PROJECT_LOCATION+
"/src"
169 managers =
parseJSON(
'/cmsdoxygen/tcproxy.php?type=managers')
174 fileIN = open(SCRIPTS_LOCATION+
"/indexPage/indexpage_warning.html",
"r")
175 indexPageTemplateHTML = fileIN.read()
177 reason = "Failed during preparing treeview. "
179 reason +=
" Error on import"
180 output = open(PROJECT_LOCATION+
"/doc/html/index.html",
"w")
181 output.write(indexPageTemplateHTML.replace(
"@CMSSW_VERSION@", CMSSW_VERSION).
replace(
"@REASON@", reason))
187 indexPageRowCounter = 0
189 <tr class=\"@ROW_CLASS@\">
190 <td width=\"50%\"><a href=\"#@SUBSYSTEM@\" onclick=\"javascript:getIframe('@SUBSYSTEM@')\">@SUBSYSTEM@</a></td>
191 <td width=\"50%\" class=\"contact\">@CONTACTS@</td>
193 <tr><td colspan=\"2\"><span id=\"@SUBSYSTEM@\"></span></td></tr>
196 indexPageBlockNoTree =
"""
197 <tr class=\"@ROW_CLASS@\">
198 <td width=\"50%\">@SUBSYSTEM@</td>
199 <td width=\"50%\" class=\"contact\">@CONTACTS@</td>
201 <tr><td colspan=\"2\"><span id=\"@SUBSYSTEM@\"></span></td></tr>
206 map[
"Full Simulation"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideSimulation"
207 map[
"Generators"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideEventGeneration"
208 map[
"Fast Simulation"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFastSimulation"
209 map[
"L1"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideL1Trigger"
210 map[
"HLT"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideHighLevelTrigger"
211 map[
"Reconstruction"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideReco"
212 map[
"Core"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrameWork"
213 map[
"DQM"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideDQM"
214 map[
"Database"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCondDB"
215 map[
"Calibration and Alignment"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCalAli"
216 map[
"Analysis"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrab"
217 map[
"Geometry"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideDetectorDescription"
218 map[
"DAQ"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/TriDASWikiHome"
219 map[
"Visualization"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideVisualization"
220 map[
"Documentation"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuide"
225 for subsystem
in subsystems:
229 treeHTML = treeTemplateHTML.replace(
"@TREE@", branchHTML).
replace(
"@SUBSYSTEM@", subsystem).
replace(
"@CMSSW_VERSION@", CMSSW_VERSION)
232 block = indexPageBlockNoTree
233 if (map.has_key(subsystem)):
234 block = indexPageBlock
235 treeHTML = treeHTML.replace(
"@LINK_TO_TWIKI@", map[subsystem])
239 for manager
in managers[subsystem]:
242 contacts +=
"<a href=\"mailto:"+users[manager][1]+
"\">" + users[manager][0] +
"</a>"
245 if indexPageRowCounter % 2 == 0:
250 indexPageHTML += block.replace(
"@CONTACTS@", contacts).
replace(
"@SUBSYSTEM@", subsystem).
replace(
"@ROW_CLASS@", rowCssClass)
252 output = open(PROJECT_LOCATION+
"/doc/html/splittedTree/"+subsystem+
".html",
"w")
253 output.write(treeHTML)
256 indexPageHTML = indexPageTemplate.replace(
"@TREE_BLOCKS@", indexPageHTML).
replace(
"@CMSSW_VERSION@", CMSSW_VERSION)
257 output = open(PROJECT_LOCATION+
"/doc/html/index.html",
"w")
258 output.write(indexPageHTML)
def generateLeavesHTML
Generates HTML for subpackage.
def preparePackageDocumentationLinks
Extract links to package documentation.
def generateTree
Fetches information about Subsystems/Packages/Subpackages from TagCollector.
def loadTemplates
Read template file.
def prepareRefManFiles
Prepate dictionary of doxygen generated html files.
def formatCVSLink
Format CVS link.
def formatPackageDocumentationLink
def generateBranchHTML
Generates HTML for Subsystem.