[virt-manager] [PATCH 1/5] pylint: Use pylint.lint module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 setup.py | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/setup.py b/setup.py
index cd0278ba..33a1b478 100755
--- a/setup.py
+++ b/setup.py
@@ -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):
-- 
2.14.3

_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list



[Index of Archives]     [Linux Virtualization]     [KVM Development]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux