[oe-commits] Ed Bartosh : wic: code cleanup: pylint misc.py

git at git.openembedded.org git at git.openembedded.org
Fri Aug 7 11:34:57 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: 136a2a7f8b90aa6a1ab8246ae7ce34d456e7e4aa
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=136a2a7f8b90aa6a1ab8246ae7ce34d456e7e4aa

Author: Ed Bartosh <ed.bartosh at linux.intel.com>
Date:   Mon Aug  3 16:51:50 2015 +0300

wic: code cleanup: pylint misc.py

Fixed pylint warnings.
Increased pylint score from 8.02 to 9.40.

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/lib/wic/utils/oe/misc.py | 40 +++++++++++++++++++++-------------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py
index 0fa8a53..d399f2a 100644
--- a/scripts/lib/wic/utils/oe/misc.py
+++ b/scripts/lib/wic/utils/oe/misc.py
@@ -24,6 +24,7 @@
 # AUTHORS
 # Tom Zanussi <tom.zanussi (at] linux.intel.com>
 #
+"""Miscellaneous functions."""
 
 from collections import defaultdict
 
@@ -56,14 +57,14 @@ def __exec_cmd(cmd_and_args, as_shell=False, catch=3):
     msger.debug(args)
 
     if as_shell:
-        rc, out = runner.runtool(cmd_and_args, catch)
+        ret, out = runner.runtool(cmd_and_args, catch)
     else:
-        rc, out = runner.runtool(args, catch)
+        ret, out = runner.runtool(args, catch)
     out = out.strip()
     msger.debug("__exec_cmd: output for %s (rc = %d): %s" % \
-                (cmd_and_args, rc, out))
+                (cmd_and_args, ret, out))
 
-    return (rc, out)
+    return (ret, out)
 
 
 def exec_cmd(cmd_and_args, as_shell=False, catch=3):
@@ -72,10 +73,11 @@ def exec_cmd(cmd_and_args, as_shell=False, catch=3):
 
     Exits if rc non-zero
     """
-    rc, out = __exec_cmd(cmd_and_args, as_shell, catch)
+    ret, out = __exec_cmd(cmd_and_args, as_shell, catch)
 
-    if rc != 0:
-        msger.error("exec_cmd: %s returned '%s' instead of 0" % (cmd_and_args, rc))
+    if ret != 0:
+        msger.error("exec_cmd: %s returned '%s' instead of 0" % \
+                    (cmd_and_args, ret))
 
     return out
 
@@ -97,9 +99,9 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3):
     args = cmd_and_args.split()
     msger.debug(args)
 
-    rc, out = __exec_cmd(native_cmd_and_args, True, catch)
+    ret, out = __exec_cmd(native_cmd_and_args, True, catch)
 
-    if rc == 127: # shell command-not-found
+    if ret == 127: # shell command-not-found
         prog = args[0]
         msg = "A native program %s required to build the image "\
               "was not found (see details above).\n\n" % prog
@@ -114,11 +116,11 @@ def exec_native_cmd(cmd_and_args, native_sysroot, catch=3):
     if out:
         msger.debug('"%s" output: %s' % (args[0], out))
 
-    if rc != 0:
+    if ret != 0:
         msger.error("exec_cmd: '%s' returned '%s' instead of 0" % \
-                    (cmd_and_args, rc))
+                    (cmd_and_args, ret))
 
-    return (rc, out)
+    return ret, out
 
 BOOTDD_EXTRA_SPACE = 16384
 
@@ -137,10 +139,10 @@ def get_bitbake_var(var, image=None):
 
         log_level = msger.get_loglevel()
         msger.set_loglevel('normal')
-        rc, lines = __exec_cmd(cmd)
+        ret, lines = __exec_cmd(cmd)
         msger.set_loglevel(log_level)
 
-        if rc:
+        if ret:
             print "Couldn't get '%s' output." % cmd
             print "Bitbake failed with error:\n%s\n" % lines
             return
@@ -176,14 +178,14 @@ def parse_sourceparams(sourceparams):
 
     params = sourceparams.split(',')
     if params:
-        for p in params:
-            if not p:
+        for par in params:
+            if not par:
                 continue
-            if not '=' in p:
-                key = p
+            if not '=' in par:
+                key = par
                 val = None
             else:
-                key, val = p.split('=')
+                key, val = par.split('=')
             params_dict[key] = val
 
     return params_dict



More information about the Openembedded-commits mailing list