CMS 3D CMS Logo

Classes | Functions | Variables

cmsCodeRules::showPage Namespace Reference

Classes

class  BuildViewer

Functions

def addDash
def createLogFiles
def getIB
def main
def numberConverter
def run

Variables

string __author__ = "Aurelija"
string __date__ = "$2010-08-12 10.50.40$"

Function Documentation

def cmsCodeRules::showPage::addDash (   table,
  ruleNr 
)

Definition at line 126 of file showPage.py.

00127                           :
00128     for index, tableRow in enumerate(table):
00129         if len(tableRow)-1 != ruleNr + 1:
00130             table[index] = table[index] + ('-',)

def cmsCodeRules::showPage::createLogFiles (   rulesResult,
  logsDir,
  wkDay 
)

Definition at line 138 of file showPage.py.

00139                                                :
00140     logDir = join(logsDir,"logs")
00141     if os.path.exists(logDir):
00142         rmtree(logDir)
00143     for ruleName in rulesNames:
00144         try:
00145             ruleResult = rulesResult[ruleName]
00146             for package, packageResult in ruleResult:
00147                 logsDir = join(logDir, package)
00148                 if not os.path.exists(logsDir): os.makedirs(logsDir, 0755)
00149                 file = open(join(logsDir, "log.html"), 'a')
00150                 file.write('Rule %s'%ruleName)
00151                 file.write("<br/>")
00152                 for path, lineNumbers in packageResult:
00153                     for line in lineNumbers:
00154                         directory = join(package, path)
00155                         file.write('<a href="http://cmslxr.fnal.gov/lxr/source/%s?v=%s#%s">%s:%s</a>\n'%(directory, wkDay, numberConverter(line), directory, line))
00156                         file.write("<br/>")
00157                 file.write('\n')
00158                 file.close()
00159         except KeyError:
00160             pass

def cmsCodeRules::showPage::getIB (   pathIn)

Definition at line 17 of file showPage.py.

00018                  :
00019 
00020     ib = None
00021     wkDay = None
00022     dirs = os.path.abspath(pathIn).split('/')
00023     for item in dirs:
00024         if item.startswith('CMSSW_'):
00025             ib = item
00026             break
00027 
00028     if ib:
00029         import datetime
00030         fooYr, m, d, hr = ib.split('-')
00031         wkDay = datetime.date( int(fooYr[-4:]), int(m), int(d) ).strftime("%a")
00032 
00033     return ib, wkDay

def cmsCodeRules::showPage::main ( )

Definition at line 205 of file showPage.py.

00206           :
00207 
00208     parser = OptionParser()
00209     parser.add_option("-l", "-L", dest="logDir", help = "creates log files to DIRECTORY", metavar = "DIRECTORY", default = os.getcwd())
00210     parser.add_option("-p", "-P", dest="pickleDir", help = "reads pickle files from DIRECTORY", metavar = "DIRECTORY", default = os.getcwd())
00211     parser.add_option("-c", "-C", dest="htmlDir", help = "creates cmsCRPage.html file to DIRECTORY", metavar = "DIRECTORY", default = os.getcwd())
00212     (options, args) = parser.parse_args()
00213 
00214     logsDir = options.logDir
00215     pickleDir = options.pickleDir
00216     htmlDir = options.htmlDir
00217 
00218     if not os.path.exists(logsDir):
00219         print "Error: wrong directory %s"%logsDir
00220         return
00221 
00222     if not os.path.exists(pickleDir):
00223         print "Error: wrong directory %s"%pickleDir
00224         return
00225 
00226     if not os.path.exists(htmlDir):
00227         print "Error: wrong directory %s"%htmlDir
00228         return
00229 
00230     run(pickleDir, logsDir, htmlDir)
00231 
00232     return

def cmsCodeRules::showPage::numberConverter (   number)

Definition at line 131 of file showPage.py.

00132                            :
00133     number = str(number)
00134     length = len(number)
00135     if  length < 3:
00136        number = (3-length)*str(0) + number
00137     return number

def cmsCodeRules::showPage::run (   pickleDir,
  logsDir,
  htmlDir 
)

Definition at line 161 of file showPage.py.

00162                                     :
00163     aoSorting = ""
00164     for i in range(len(ordering)):
00165         aoSorting += "["+ str(i+1) +",'desc'],"
00166     aoSorting += "[0, 'asc']"
00167 
00168     style = """
00169 
00170     <style type="text/css" title="currentStyle">
00171        @import "/SDT/html/jsExt/dataTables/media/css/demo_table.css";
00172     </style>
00173 
00174     <script type="text/javascript" src="/SDT/html/jsExt/dataTables/media/js/jquery.js"></script>
00175     <script type="text/javascript" src="/SDT/html/jsExt/dataTables/media/js/jquery.dataTables.js"></script>
00176                         
00177     <script type="text/javascript" charset="utf-8">
00178         /* Initialise the table with the required column sorting data types */
00179         $(document).ready(function() {
00180                 $('#mainTable').dataTable( {
00181                         "oLanguage": {
00182                                 "sLengthMenu": "Display _MENU_ records per page",
00183                                 "sInfoEmpty": "Showing 0 to 0 of 0 records"
00184                                 },
00185                         "aaSorting": [%s]
00186                         } );
00187                 $('#descriptionTable').dataTable( {
00188                         "aaSorting": [[0, 'asc']],
00189                         "bPaginate": false,
00190                         "bLengthChange": false,
00191                         "bFilter": false,
00192                         "bSort": false,
00193                         "bInfo": false,
00194                         "bAutoWidth": false
00195                         });
00196                 $('#descriptionTable thead th').css({'border-bottom': '1px solid black'});
00197         } );
00198     </script>
00199     """%(aoSorting)
00200 
00201     fmtr = SimpleHTMLFormatter(title="CMSSW integration builds", style=style, outFile = open(join(htmlDir,"cmsCRPage.html"), "w"))
00202 
00203     bv = BuildViewer(fmtr, pickleDir, logsDir, htmlDir)
00204     bv.showResults()


Variable Documentation

Definition at line 3 of file showPage.py.

string cmsCodeRules::showPage::__date__ = "$2010-08-12 10.50.40$"

Definition at line 4 of file showPage.py.