pylint: Use pylint.lint module

The `pylint-3` executable is provided by the python3-pylint rpm
package on Fedora.
For Debian the equivalent is `pylint3`.
On Arch Linux the default version of Python is 3.

Pylint lints for the version of Python it is running. Instead of
spawning an executable, import the `pylint.lint` module and call
`Run()`.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
This commit is contained in:
Radostin Stoyanov 2018-03-02 08:01:21 +00:00 committed by Cole Robinson
parent 5ac2fe7fe4
commit 4f7bc4f4e6
1 changed files with 9 additions and 8 deletions

View File

@ -581,6 +581,8 @@ class CheckPylint(distutils.core.Command):
self.jobs = int(self.jobs)
def run(self):
import pylint.lint
files = ["setup.py", "virt-install", "virt-clone",
"virt-convert", "virt-xml", "virt-manager",
"virtcli", "virtinst", "virtconv", "virtManager",
@ -597,15 +599,14 @@ class CheckPylint(distutils.core.Command):
os.system(cmd)
print("running pylint")
cmd = "pylint-3 "
pylint_opts = [
"--rcfile", "tests/pylint.cfg",
"--output-format=%s" % output_format,
] + ["--ignore"] + [os.path.basename(p) for p in exclude]
if self.jobs:
cmd += "--jobs=%d " % self.jobs
cmd += "--rcfile tests/pylint.cfg "
cmd += "--output-format=%s " % output_format
cmd += "--ignore %s " % ",".join(
[os.path.basename(p) for p in exclude])
cmd += " ".join(files)
os.system(cmd)
pylint_opts += ["--jobs=%d" % self.jobs]
pylint.lint.Run(files + pylint_opts)
class VMMDistribution(distutils.dist.Distribution):