Changeset 176
- Timestamp:
- 02/07/07 05:07:24 (2 years ago)
- Files:
-
- trunk/cheesecake/cheesecake_index.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cheesecake/cheesecake_index.py
r173 r176 1054 1054 pylint_args = ' '.join(map(lambda x: '--disable-msg=%s' % x, disabled_messages)) 1055 1055 1056 max_execution_time = 60 1057 1058 def compute(self, files_list, package_dir): 1056 def compute(self, files_list, package_dir, pylint_max_execution_time): 1059 1057 # See if pylint script location is set via environment variable 1060 1058 pylint_location = os.environ.get("PYLINT", "pylint") … … 1089 1087 # Run pylint, but don't allow it to work longer than one minute. 1090 1088 rc, output = run_cmd("%s %s --persistent=n %s" % (pylint_location, filenames, self.pylint_args), 1091 max_timeout= self.max_execution_time)1089 max_timeout=pylint_max_execution_time) 1092 1090 if rc: 1093 1091 if output == 'Time exceeded': … … 1095 1093 # and thus won't affect the score. 1096 1094 self.cheesecake.log.debug("pylint exceeded maximum execution time of %d seconds and was terminated." % \ 1097 self.max_execution_time)1095 pylint_max_execution_time) 1098 1096 raise OSError 1099 1097 self.cheesecake.log.debug("encountered an error (%d):\n***\n%s\n***\n" % (rc, output)) … … 1294 1292 } 1295 1293 1296 def __init__(self, name="", url="", path="", sandbox=None, 1297 logfile=None, verbose=False, quiet=False, static_only=False, 1298 lite=False, keep_log=False, with_pep8=False): 1294 def __init__(self, 1295 keep_log = False, 1296 lite = False, 1297 logfile = None, 1298 name = "", 1299 path = "", 1300 pylint_max_execution_time = None, 1301 quiet = False, 1302 sandbox = None, 1303 static_only = False, 1304 url = "", 1305 verbose = False, 1306 with_pep8 = False): 1299 1307 """Initialize critical variables, download and unpack package, 1300 1308 walk package tree. … … 1324 1332 self.keep_log = keep_log 1325 1333 self.with_pep8 = with_pep8 1334 self.pylint_max_execution_time = pylint_max_execution_time 1326 1335 1327 1336 self.sandbox_pkg_file = "" … … 1820 1829 parser.add_option("--keep-log", action="store_true", dest="keep_log", 1821 1830 default=False, help="don't remove log file even if run was successful") 1831 parser.add_option("--pylint-max-execution-time", action="store", dest="pylint_max_execution_time", 1832 default=120, help="maximum time (in seconds) you allow pylint process to run (default=120)") 1822 1833 1823 1834 parser.add_option("-V", "--version", action="store_true", dest="version", … … 1843 1854 version = options.version 1844 1855 with_pep8 = options.with_pep8 1856 pylint_max_execution_time = int(options.pylint_max_execution_time) 1845 1857 1846 1858 if version: … … 1853 1865 1854 1866 try: 1855 c = Cheesecake(name=name, url=url, path=path, sandbox=sandbox, 1856 logfile=logfile, verbose=verbose, 1857 quiet=quiet, static_only=static_only, lite=lite, 1858 keep_log=keep_log, with_pep8=with_pep8) 1867 c = Cheesecake(keep_log = keep_log, 1868 lite = lite, 1869 logfile = logfile, 1870 name = name, 1871 path = path, 1872 pylint_max_execution_time = pylint_max_execution_time, 1873 quiet = quiet, 1874 sandbox = sandbox, 1875 static_only = static_only, 1876 url = url, 1877 verbose = verbose, 1878 with_pep8 = with_pep8) 1859 1879 c.compute_cheesecake_index() 1860 1880 c.cleanup()
