4 from __future__
import print_function
5 import shutil, sys, os, re, valtools, string
7 from string
import Template
9 from optparse
import OptionParser
10 from subprocess
import Popen,PIPE
15 if bname != webpage.benchmarkName_:
16 print(
"sorry, you have to go to the",bname,
"directory to produce this comparison. Note that you cannot compare different benchmarks.")
19 benchmark.release_ = release
20 print(benchmark.benchmarkUrl( website ))
21 root = benchmark.rootFileOnWebSite( website )
22 shutil.copy(root, outputRootFile)
23 print(
'retrieved ', root)
28 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."
29 webpage.parser_.add_option(
"-m",
"--macro", dest=
"macro",
30 help=
"specify the ROOT macro to be used for comparison. If empty, skip the plotting stage", default=
"compare.C")
31 webpage.parser_.add_option(
"-s",
"--submit", dest=
"submit",
33 help=
"submit the comparison to the web site",
35 webpage.parser_.add_option(
"-S",
"--submit-force", dest=
"submitForce",
37 help=
"force the submission of the comparison to the web site",
41 if len(webpage.args_)!=2:
42 webpage.parser_.print_help()
48 macro = webpage.options_.macro
49 templateFile =
'indexCompare.html'
50 indexhtml =
"%s/%s" % (webpage.templates_,templateFile)
61 webpage.setOutputDir(benchmark2.fullName())
64 if webpage.options_.macro !=
"":
65 os.system(
'root -b ' + macro)
68 infonotfoundhtml =
"%s/%s" % (webpage.templates_,
"infoNotFound.html")
71 images = webpage.readCaptions(
'c_captions.txt')
73 title = webpage.benchmarkName_
75 benchmark1Link = benchmark1.benchmarkUrl( website )
76 benchmark1Name = benchmark1.fullName()
78 benchmark2Link = benchmark2.benchmarkUrl( website )
79 benchmark2Name = benchmark2.fullName()
82 macroName = os.path.basename(macro)
84 comments = webpage.options_.comments
85 username = os.environ[
'USER']
87 ifile = open( indexhtml )
88 indexTemplate = ifile.read()
89 s = Template(indexTemplate)
90 subst = s.substitute(title = title,
91 benchmark1Link = benchmark1Link,
92 benchmark1Name = benchmark1Name,
93 benchmark2Link = benchmark2Link,
94 benchmark2Name = benchmark2Name,
95 macroLink = macroLink,
96 macroName = macroName,
102 ofile = open(
'%s/index.html' % webpage.outputDir_,
'w' )
106 ifile = open( infonotfoundhtml )
107 infoNotFoundTemplate = ifile.read()
108 s2 = Template(infoNotFoundTemplate)
109 subst2 = s2.substitute( username = os.environ[
'USER'] )
110 ofile2 = open(
'%s/infoNotFound.html' % webpage.outputDir_,
'w' )
111 ofile2.write( subst2 )
116 if webpage.options_.submitForce:
117 webpage.options_.submit =
True
119 if (webpage.options_.submit ==
True):
120 remoteName = benchmark1.benchmarkOnWebSite(website) +
'/' + webpage.outputDir_
122 comparison.submit( website,
123 webpage.options_.submitForce)
124 benchmark1.addLinkToComparison( website, comparison )
125 benchmark2.addLinkToComparison( website, comparison )