aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/engine.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-09-02 13:58:16 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-02 23:46:52 +0100
commit872cb0d5d79b26f34e6b35d7be8870d245021be4 (patch)
tree37cc334e9769e40e1df60e777e934ee7a404282f /scripts/lib/wic/engine.py
parentaf0a6d547a5a3efefdd4900f7079dfd10b85342d (diff)
downloadopenembedded-core-contrib-872cb0d5d79b26f34e6b35d7be8870d245021be4.tar.gz
wic: fix short variable names
Made short variable names longer and more readable. Fixed pylint warnings "Invalid variable name" and "Invalid argument name". Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r--scripts/lib/wic/engine.py62
1 files changed, 30 insertions, 32 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index ce942ea4c4..76b93e82f2 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -53,17 +53,17 @@ def verify_build_env():
CANNED_IMAGE_DIR = "lib/wic/canned-wks" # relative to scripts
SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR
-def build_canned_image_list(dl):
+def build_canned_image_list(path):
layers_path = misc.get_bitbake_var("BBLAYERS")
canned_wks_layer_dirs = []
if layers_path is not None:
for layer_path in layers_path.split():
- path = os.path.join(layer_path, SCRIPTS_CANNED_IMAGE_DIR)
- canned_wks_layer_dirs.append(path)
+ cpath = os.path.join(layer_path, SCRIPTS_CANNED_IMAGE_DIR)
+ canned_wks_layer_dirs.append(cpath)
- path = os.path.join(dl, CANNED_IMAGE_DIR)
- canned_wks_layer_dirs.append(path)
+ cpath = os.path.join(path, CANNED_IMAGE_DIR)
+ canned_wks_layer_dirs.append(cpath)
return canned_wks_layer_dirs
@@ -99,14 +99,13 @@ def list_canned_images(scripts_path):
continue
if fname.endswith(".wks"):
fullpath = os.path.join(canned_wks_dir, fname)
- f = open(fullpath, "r")
- lines = f.readlines()
- for line in lines:
- desc = ""
- idx = line.find("short-description:")
- if idx != -1:
- desc = line[idx + len("short-description:"):].strip()
- break
+ with open(fullpath) as wks:
+ for line in wks:
+ desc = ""
+ idx = line.find("short-description:")
+ if idx != -1:
+ desc = line[idx + len("short-description:"):].strip()
+ break
basename = os.path.splitext(fname)[0]
print " %s\t\t%s" % (basename.ljust(30), desc)
@@ -115,24 +114,23 @@ def list_canned_image_help(scripts_path, fullpath):
"""
List the help and params in the specified canned image.
"""
- f = open(fullpath, "r")
- lines = f.readlines()
found = False
- for line in lines:
- if not found:
- idx = line.find("long-description:")
+ with open(fullpath) as wks:
+ for line in wks:
+ if not found:
+ idx = line.find("long-description:")
+ if idx != -1:
+ print
+ print line[idx + len("long-description:"):].strip()
+ found = True
+ continue
+ if not line.strip():
+ break
+ idx = line.find("#")
if idx != -1:
- print
- print line[idx + len("long-description:"):].strip()
- found = True
- continue
- if not line.strip():
- break
- idx = line.find("#")
- if idx != -1:
- print line[idx + len("#:"):].rstrip()
- else:
- break
+ print line[idx + len("#:"):].rstrip()
+ else:
+ break
def list_source_plugins():
@@ -186,10 +184,10 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
if debug:
msger.set_loglevel('debug')
- cr = creator.Creator()
+ crobj = creator.Creator()
- cr.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir,
- wks_file, image_output_dir, oe_builddir, compressor or ""])
+ crobj.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir,
+ wks_file, image_output_dir, oe_builddir, compressor or ""])
print "\nThe image(s) were created using OE kickstart file:\n %s" % wks_file