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 return json.loads(html)
34 output = os.popen(
"find "+DOC_DIR+
" -wholename '*/class*.html' -not \( -name '*-members.html' \) -print")
35 lines = output.read().
split(
"\n")
39 (head, tail) = os.path.split(line)
40 refmanfiles[tail.replace(
"class",
"").
replace(
".html",
"")] = baseUrl+line[line.find(CMSSW_VERSION):]
44 source = open(DOC_DIR+
"/pages.html",
"r")
45 lines = source.read().split("\n")
49 if (line.find(
"li><a class=\"el\" href=\"") != -1):
50 packageDocLinks.append(line.split(
"\"")[3])
54 cvsLink =
"[ <a target=\"_blank\" href=\""+cvsBaseUrl+
"/"+package+
"/"+subpackage+
"\">cvs</a> ]"
58 for link
in packageDocLinks:
59 if (link.find(package+
"_"+subpackage+
".html") != -1):
60 return "[ <a target=\"_blank\" href=\"../"+link+
"\">packageDoc</a> ]"
67 data =
parseJSON(
'/cmsdoxygen/tcproxy.php?type=packages&release=' + release)
70 subsystems = sorted(data.keys())
72 for subsystem
in subsystems:
74 for packagesub
in data[subsystem]:
75 (package, subpackage) = packagesub.split(
"/")
77 if not package
in tree[subsystem]:
78 tree[subsystem][package] = []
79 tree[subsystem][package].
append(subpackage)
81 return (tree, subsystems)
87 dirList=os.listdir(SRC_DIR +
"/" + package+
"/"+subpackage+
"/interface/")
88 for classfile
in dirList:
89 if classfile.endswith(
".h"):
90 classfile = classfile.replace(
".h",
"")
91 for key
in refmanfiles.keys():
92 if (key.find(classfile) != -1):
93 classfile =
"<a target=\"_blank\" href=\""+refmanfiles[key]+
"\">"+classfile+
"</a>"
96 html +=
"<li>"+classfile+
"</li>"
101 html =
"<ul>"+html+
"</ul>"
109 for package,subpackages
in sorted(tree[branch].items()):
110 branchHTML +=
"<li><span><strong>"+package+
"</strong></span><ul>"
112 for subpackage
in subpackages:
119 branchHTML +=
"</li>"
124 templateFile = SCRIPTS_LOCATION+
"/indexPage/tree_template.html"
126 fileIN = open(templateFile,
"r")
127 treeTemplateHTML = fileIN.read()
131 templateFile = SCRIPTS_LOCATION+"/indexPage/indexpage_template.html"
132 fileIN = open(templateFile,
"r")
133 indexPageTemplateHTML = fileIN.read()
137 return treeTemplateHTML, indexPageTemplateHTML
139 if len(sys.argv) < 3:
140 print "Not enough arguments, try script.py CMSSW_VERSION PROJECT_LOCATION SCRIPT_LOCATION"
143 CMSSW_VERSION = sys.argv[1]
144 PROJECT_LOCATION = sys.argv[2]
145 SCRIPTS_LOCATION = sys.argv[3]
147 SRC_DIR = PROJECT_LOCATION+
"/src"
160 managers =
parseJSON(
'/cmsdoxygen/tcproxy.php?type=managers')
165 fileIN = open(SCRIPTS_LOCATION+
"/indexPage/indexpage_warning.html",
"r")
166 indexPageTemplateHTML = fileIN.read()
168 reason = "Failed during preparing treeview. "
170 reason +=
" Error on import"
171 output = open(PROJECT_LOCATION+
"/doc/html/index.html",
"w")
172 output.write(indexPageTemplateHTML.replace(
"@CMSSW_VERSION@", CMSSW_VERSION).
replace(
"@REASON@", reason))
178 indexPageRowCounter = 0
180 <tr class=\"@ROW_CLASS@\">
181 <td width=\"50%\"><a href=\"#@SUBSYSTEM@\" onclick=\"javascript:getIframe('@SUBSYSTEM@')\">@SUBSYSTEM@</a></td>
182 <td width=\"50%\" class=\"contact\">@CONTACTS@</td>
184 <tr><td colspan=\"2\"><span id=\"@SUBSYSTEM@\"></span></td></tr>
187 indexPageBlockNoTree =
"""
188 <tr class=\"@ROW_CLASS@\">
189 <td width=\"50%\">@SUBSYSTEM@</td>
190 <td width=\"50%\" class=\"contact\">@CONTACTS@</td>
192 <tr><td colspan=\"2\"><span id=\"@SUBSYSTEM@\"></span></td></tr>
197 map[
"Full Simulation"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideSimulation"
198 map[
"Generators"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideEventGeneration"
199 map[
"Fast Simulation"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFastSimulation"
200 map[
"L1"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideL1Trigger"
201 map[
"HLT"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideHighLevelTrigger"
202 map[
"Reconstruction"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideReco"
203 map[
"Core"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideFrameWork"
204 map[
"DQM"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideDQM"
205 map[
"Database"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCondDB"
206 map[
"Calibration and Alignment"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCalAli"
207 map[
"Analysis"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrab"
208 map[
"Geometry"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideDetectorDescription"
209 map[
"DAQ"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/TriDASWikiHome"
210 map[
"Visualization"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideVisualization"
211 map[
"Documentation"] =
"https://twiki.cern.ch/twiki/bin/view/CMS/SWGuide"
216 for subsystem
in subsystems:
220 treeHTML = treeTemplateHTML.replace(
"@TREE@", branchHTML).
replace(
"@SUBSYSTEM@", subsystem).
replace(
"@CMSSW_VERSION@", CMSSW_VERSION)
223 block = indexPageBlockNoTree
224 if (map.has_key(subsystem)):
225 block = indexPageBlock
226 treeHTML = treeHTML.replace(
"@LINK_TO_TWIKI@", map[subsystem])
230 for manager
in managers[subsystem]:
233 contacts +=
"<a href=\"mailto:"+users[manager][1]+
"\">" + users[manager][0] +
"</a>"
236 if indexPageRowCounter % 2 == 0:
241 indexPageHTML += block.replace(
"@CONTACTS@", contacts).
replace(
"@SUBSYSTEM@", subsystem).
replace(
"@ROW_CLASS@", rowCssClass)
243 output = open(PROJECT_LOCATION+
"/doc/html/splittedTree/"+subsystem+
".html",
"w")
244 output.write(treeHTML)
247 indexPageHTML = indexPageTemplate.replace(
"@TREE_BLOCKS@", indexPageHTML).
replace(
"@CMSSW_VERSION@", CMSSW_VERSION)
248 output = open(PROJECT_LOCATION+
"/doc/html/index.html",
"w")
249 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.