4 import shutil, sys, os, re, valtools, string
6 from string
import Template
8 from optparse
import OptionParser
9 from subprocess
import Popen,PIPE
14 if bname != webpage.benchmarkName_:
15 print "sorry, you have to go to the",bname,
"directory to produce this comparison. Note that you cannot compare different benchmarks."
18 benchmark.release_ = release
19 print benchmark.benchmarkUrl( website )
20 root = benchmark.rootFileOnWebSite( website )
21 shutil.copy(root, outputRootFile)
22 print 'retrieved ', root
27 webpage.parser_.usage =
"example: %prog CMSSW_3_1_0_pre7/TauBenchmarkGeneric_ZTT_FastSim_IDEAL CMSSW_3_1_0_pre7/TauBenchmarkGeneric_TEST\nThe list of benchmarks can be obtained using the listBenchmarks.py command."
28 webpage.parser_.add_option(
"-m",
"--macro", dest=
"macro",
29 help=
"specify the ROOT macro to be used for comparison. If empty, skip the plotting stage", default=
"compare.C")
30 webpage.parser_.add_option(
"-s",
"--submit", dest=
"submit",
32 help=
"submit the comparison to the web site",
34 webpage.parser_.add_option(
"-S",
"--submit-force", dest=
"submitForce",
36 help=
"force the submission of the comparison to the web site",
40 if len(webpage.args_)!=2:
41 webpage.parser_.print_help()
47 macro = webpage.options_.macro
48 templateFile =
'indexCompare.html'
49 indexhtml =
"%s/%s" % (webpage.templates_,templateFile)
60 webpage.setOutputDir(benchmark2.fullName())
63 if webpage.options_.macro !=
"":
64 os.system(
'root -b ' + macro)
67 infonotfoundhtml =
"%s/%s" % (webpage.templates_,
"infoNotFound.html")
70 images = webpage.readCaptions(
'c_captions.txt')
72 title = webpage.benchmarkName_
74 benchmark1Link = benchmark1.benchmarkUrl( website )
75 benchmark1Name = benchmark1.fullName()
77 benchmark2Link = benchmark2.benchmarkUrl( website )
78 benchmark2Name = benchmark2.fullName()
81 macroName = os.path.basename(macro)
83 comments = webpage.options_.comments
84 username = os.environ[
'USER']
86 ifile = open( indexhtml )
87 indexTemplate = ifile.read()
88 s = Template(indexTemplate)
89 subst = s.substitute(title = title,
90 benchmark1Link = benchmark1Link,
91 benchmark1Name = benchmark1Name,
92 benchmark2Link = benchmark2Link,
93 benchmark2Name = benchmark2Name,
94 macroLink = macroLink,
95 macroName = macroName,
101 ofile = open(
'%s/index.html' % webpage.outputDir_,
'w' )
105 ifile = open( infonotfoundhtml )
106 infoNotFoundTemplate = ifile.read()
107 s2 = Template(infoNotFoundTemplate)
108 subst2 = s2.substitute( username = os.environ[
'USER'] )
109 ofile2 = open(
'%s/infoNotFound.html' % webpage.outputDir_,
'w' )
110 ofile2.write( subst2 )
115 if webpage.options_.submitForce:
116 webpage.options_.submit =
True
118 if (webpage.options_.submit ==
True):
119 remoteName = benchmark1.benchmarkOnWebSite(website) +
'/' + webpage.outputDir_
121 comparison.submit( website,
122 webpage.options_.submitForce)
123 benchmark1.addLinkToComparison( website, comparison )
124 benchmark2.addLinkToComparison( website, comparison )