Changeset 170

Show
Ignore:
Timestamp:
02/04/07 07:41:23 (2 years ago)
Author:
mk
Message:

Made pep8 optional index, which can be enabled by --with-pep8 option.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cheesecake/cheesecake_index.py

    r169 r170  
    11691169        return self.value 
    11701170 
     1171    def decide_before_download(self, cheesecake): 
     1172        return cheesecake.with_pep8 
     1173 
    11711174class IndexCodeKwalitee(Index): 
    11721175    name = "CODE KWALITEE" 
     
    12551258    def __init__(self, name="", url="", path="", sandbox=None, 
    12561259                 logfile=None, verbose=False, quiet=False, static_only=False, 
    1257                  lite=False, keep_log=False): 
     1260                 lite=False, keep_log=False, with_pep8=False): 
    12581261        """Initialize critical variables, download and unpack package, 
    12591262        walk package tree. 
     
    12821285        self.lite = lite 
    12831286        self.keep_log = keep_log 
     1287        self.with_pep8 = with_pep8 
    12841288 
    12851289        self.sandbox_pkg_file = "" 
     
    17431747    """ 
    17441748    parser = OptionParser() 
    1745     parser.add_option("--keep-log", action="store_true", dest="keep_log", 
    1746                       default=False, help="don't remove log file even if run was successful") 
    1747     parser.add_option("--lite", action="store_true", dest="lite", 
    1748                       default=False, help="don't run time-consuming tests (default=False)") 
    1749     parser.add_option("-l", "--logfile", dest="logfile", 
    1750                       default=None, 
    1751                       help="file to log all cheesecake messages") 
     1749 
     1750    # Options for package retrieval. 
    17521751    parser.add_option("-n", "--name", dest="name", 
    17531752                      default="", help="package name (will be retrieved via setuptools utilities, if present)") 
    17541753    parser.add_option("-p", "--path", dest="path", 
    17551754                      default="", help="path of tar.gz/zip package on local file system") 
     1755    parser.add_option("-u", "--url", dest="url", 
     1756                      default="", help="package URL") 
     1757 
     1758    # Output formatting options. 
    17561759    parser.add_option("-q", "--quiet", action="store_true", dest="quiet", 
    17571760                      default=False, help="only print Cheesecake index value (default=False)") 
     1761    parser.add_option("-v", "--verbose", action="store_true", dest="verbose", 
     1762                      default=False, help="verbose output (default=False)") 
     1763 
     1764    # Index choice options. 
     1765    parser.add_option("--lite", action="store_true", dest="lite", 
     1766                      default=False, help="don't run time-consuming tests (default=False)") 
     1767    parser.add_option("-t", "--static", action="store_true", dest="static", 
     1768                      default=False, help="don't run any code from the package being tested (default=False)") 
     1769    parser.add_option("--with-pep8", action="store_true", dest="with_pep8", 
     1770                      default=False, help="check pep8 conformance") 
     1771 
     1772    # Other options. 
     1773    parser.add_option("-l", "--logfile", dest="logfile", 
     1774                      default=None, 
     1775                      help="file to log all cheesecake messages") 
    17581776    parser.add_option("-s", "--sandbox", dest="sandbox", 
    17591777                      default=None, 
    17601778                      help="directory where package will be unpacked "\ 
    17611779                           "(default is to use random directory inside %s)" % tempfile.gettempdir()) 
    1762     parser.add_option("-t", "--static", action="store_true", dest="static", 
    1763                       default=False, help="don't run any code from the package being tested (default=False)") 
    1764     parser.add_option("-u", "--url", dest="url", 
    1765                       default="", help="package URL") 
    1766     parser.add_option("-v", "--verbose", action="store_true", dest="verbose", 
    1767                       default=False, help="verbose output (default=False)") 
     1780    parser.add_option("--keep-log", action="store_true", dest="keep_log", 
     1781                      default=False, help="don't remove log file even if run was successful") 
     1782 
    17681783    parser.add_option("-V", "--version", action="store_true", dest="version", 
    17691784                      default=False, help="Output cheesecake version and exit") 
     
    17871802    verbose = options.verbose 
    17881803    version = options.version 
     1804    with_pep8 = options.with_pep8 
    17891805 
    17901806    if version: 
     
    18001816                       logfile=logfile, verbose=verbose, 
    18011817                       quiet=quiet, static_only=static_only, lite=lite, 
    1802                        keep_log=keep_log
     1818                       keep_log=keep_log, with_pep8=with_pep8
    18031819        c.compute_cheesecake_index() 
    18041820        c.cleanup()