[libvir PATCH] run: fix flake8 violations

Daniel P. Berrangé posted 1 patch 1 week, 5 days ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/20210401141258.74075-1-berrange@redhat.com
run.in | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)

[libvir PATCH] run: fix flake8 violations

Posted by Daniel P. Berrangé 1 week, 5 days ago
Two blank lines are needed either side of functions.

Comments must have a single space character immediately after
the "#".

The unused exception variable can be removed.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---

I dropped the ball by not running syntax check on the 'run' script
changes. Pushed this fixup for the style problems.

 run.in | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/run.in b/run.in
index b710ba87fb..b778505a33 100644
--- a/run.in
+++ b/run.in
@@ -16,7 +16,7 @@
 # License along with this library; If not, see
 # <http://www.gnu.org/licenses/>.
 
-#----------------------------------------------------------------------
+# ----------------------------------------------------------------------
 #
 # With this script you can run libvirt programs without needing to
 # install them first.  You just have to do for example:
@@ -38,7 +38,7 @@
 #
 #   sudo ./run virsh list --all
 #
-#----------------------------------------------------------------------
+# ----------------------------------------------------------------------
 
 import os
 import os.path
@@ -46,6 +46,7 @@ import random
 import sys
 import subprocess
 
+
 # Function to intelligently prepend a path to an environment variable.
 # See https://stackoverflow.com/a/9631350
 def prepend(env, varname, extradir):
@@ -54,6 +55,7 @@ def prepend(env, varname, extradir):
     else:
         env[varname] = extradir
 
+
 here = "@abs_builddir@"
 
 if len(sys.argv) < 2:
@@ -93,29 +95,36 @@ modular_daemons = [
     "virtxend",
 ]
 
+
 def is_modular_daemon(name):
     return name in modular_daemons
 
+
 def is_monolithic_daemon(name):
     return name == "libvirtd"
 
+
 def is_systemd_host():
     if os.getuid() != 0:
         return False
     return os.path.exists("/run/systemd/system")
 
+
 def daemon_units(name):
     return [name + suffix for suffix in [
         ".service", ".socket", "-ro.socket", "-admin.socket"]]
 
+
 def is_unit_active(name):
     ret = subprocess.call(["systemctl", "is-active", "-q", name])
     return ret == 0
 
+
 def change_unit(name, action):
     ret = subprocess.call(["systemctl", action, "-q", name])
     return ret == 0
 
+
 try_stop_units = []
 if is_systemd_host():
     name = os.path.basename(prog)
@@ -152,7 +161,7 @@ else:
 
         print("Running %s..." % prog)
         ret = subprocess.call([prog] + args, env=env)
-    except KeyboardInterrupt as ex:
+    except KeyboardInterrupt:
         pass
     finally:
         print("Re-starting original systemd units...")
-- 
2.30.2