@@ -144,21 +144,32 @@ def finalize_options(self):
144144 pass
145145
146146 def _run (self ):
147- files = ["bugzilla/" , "bin-bugzilla" , "examples/*.py" , "tests/*.py" ]
147+ import pylint .lint
148+ import pycodestyle
149+
150+ files = (["bugzilla/" , "bin-bugzilla" ] +
151+ glob .glob ("examples/*.py" ) +
152+ glob .glob ("tests/*.py" ))
148153 output_format = sys .stdout .isatty () and "colorized" or "text"
149154
150- if os .path .exists ("/usr/bin/pylint-2" ):
151- cmd = "pylint-2 "
152- else :
153- cmd = "pylint "
154- cmd += "--output-format=%s " % output_format
155- cmd += " " .join (files )
156- os .system (cmd + " --rcfile tests/pylint.cfg" )
157-
158- print ("running pep8" )
159- cmd = "pep8 "
160- cmd += " " .join (files )
161- os .system (cmd + " --config tests/pep8.cfg --exclude oldclasses.py" )
155+ print ("running pycodestyle" )
156+ style_guide = pycodestyle .StyleGuide (
157+ config_file = 'tests/pycodestyle.cfg' ,
158+ paths = files ,
159+ )
160+ style_guide .options .exclude = pycodestyle .normalize_paths (
161+ "bugzilla/oldclasses.py" ,
162+ )
163+ report = style_guide .check_files ()
164+ if style_guide .options .count :
165+ sys .stderr .write (str (report .total_errors ) + '\n ' )
166+
167+ print ("running pylint" )
168+ pylint_opts = [
169+ "--rcfile" , "tests/pylint.cfg" ,
170+ "--output-format=%s" % output_format ,
171+ ]
172+ pylint .lint .Run (files + pylint_opts )
162173
163174 def run (self ):
164175 os .link ("bin/bugzilla" , "bin-bugzilla" )
0 commit comments