[virt-tools-list] [virt-bootstrap] [PATCH v2 01/14] setup: Use explicit import

Radostin Stoyanov rstoyanov1 at gmail.com
Tue Aug 1 11:28:42 UTC 2017


Reduce the number of import statements and improve readability.
---
 setup.py | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/setup.py b/setup.py
index 2f299b6..2d06144 100755
--- a/setup.py
+++ b/setup.py
@@ -9,9 +9,8 @@ based on setuptools.
 import codecs
 import os
 import sys
-from subprocess import call
-from setuptools import Command
-from setuptools import setup
+import subprocess
+import setuptools
 
 
 def read(fname):
@@ -23,7 +22,7 @@ def read(fname):
         return fobj.read()
 
 
-class CheckPylint(Command):
+class CheckPylint(setuptools.Command):
     """
     Check python source files with pylint and pycodestyle.
     """
@@ -55,7 +54,7 @@ class CheckPylint(Command):
 
         print(">>> Running pycodestyle ...")
         cmd = "pycodestyle "
-        if (call(cmd + files, shell=True) != 0):
+        if (subprocess.call(cmd + files, shell=True) != 0):
             res = 1
 
         print(">>> Running pylint ...")
@@ -63,13 +62,13 @@ class CheckPylint(Command):
         if self.errors_only:
             args = "-E"
         cmd = "pylint %s --output-format=%s " % (args, format(output_format))
-        if (call(cmd + files, shell=True) != 0):
+        if (subprocess.call(cmd + files, shell=True) != 0):
             res = 1
 
         sys.exit(res)
 
 
-setup(
+setuptools.setup(
     name='virt-bootstrap',
     version='0.1.0',
     author='Cedric Bosdonnat',
-- 
2.13.3




More information about the virt-tools-list mailing list