Changeset 10:5ab6b283ac51 in livinglogic.python.pycoco

Show
Ignore:
Timestamp:
10/01/06 23:11:02 (13 years ago)
Author:
Walter Doerwald <walter@…>
Branch:
default
Message:

Add an option for specifying the output directory.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/pycoco.py

    r9 r10  
    11# -*- coding: iso-8859-1 -*- 
    22 
    3 import os, datetime, urllib 
     3import sys, os, datetime, urllib, optparse 
    44 
    55try: 
     
    239239 
    240240class Python_GenerateCodeCoverage(sisyphus.Job): 
    241     def __init__(self): 
     241    def __init__(self, outputdir): 
    242242        sisyphus.Job.__init__(self, 60*60, name="Python_GenerateCodeCoverage", raiseerrors=1) 
    243243        self.url = "http://svn.python.org/snapshots/python.tar.bz2" 
    244244        self.tarfile = "python.tar.bz2" 
    245         self.outputdir = url.Dir("~/documentroot/coverage.livinglogic.de/") 
     245        self.outputdir = url.Dir(outputdir) 
    246246 
    247247        self.configurecmd = "./configure --enable-unicode=ucs4 --with-pydebug" 
     
    439439        self.logLoop("done with project Python (%s; %d files)" % (self.timestamp.strftime("%Y-%m-%d %H:%M:%S"), len(files))) 
    440440 
     441 
     442def main(): 
     443    p = optparse.OptionParser(usage="usage: %prog [options]") 
     444    p.add_option("-o", "--outputdir", dest="outputdir", help="Directory where to put the HTML files", default="~/pycoco") 
     445    (options, args) = p.parse_args(args) 
     446    if len(args) != =: 
     447        p.error("incorrect number of arguments") 
     448        return 1 
     449    sisyphus.execute(Python_GenerateCodeCoverage(options.outputdir)) 
     450    return 0 
     451 
     452 
    441453if __name__=="__main__": 
    442     sisyphus.execute(Python_GenerateCodeCoverage()) 
     454    sys.exit(main())