summaryrefslogtreecommitdiffstats
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-03 12:43:31 +0100
commit791a3912d98014105bdb2a8585e4a1b7ae8120b1 (patch)
treebcfb06b795482f6113cfa6b5c967a0bbb9b4bc1c /scripts/lib/wic/engine.py
parent14b47e22f9b2566320ab6ef103da1501bca129de (diff)
downloadpoky-791a3912d98014105bdb2a8585e4a1b7ae8120b1.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". (From OE-Core rev: 872cb0d5d79b26f34e6b35d7be8870d245021be4) 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():
53CANNED_IMAGE_DIR = "lib/wic/canned-wks" # relative to scripts 53CANNED_IMAGE_DIR = "lib/wic/canned-wks" # relative to scripts
54SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR 54SCRIPTS_CANNED_IMAGE_DIR = "scripts/" + CANNED_IMAGE_DIR
55 55
56def build_canned_image_list(dl): 56def build_canned_image_list(path):
57 layers_path = misc.get_bitbake_var("BBLAYERS") 57 layers_path = misc.get_bitbake_var("BBLAYERS")
58 canned_wks_layer_dirs = [] 58 canned_wks_layer_dirs = []
59 59
60 if layers_path is not None: 60 if layers_path is not None:
61 for layer_path in layers_path.split(): 61 for layer_path in layers_path.split():
62 path = os.path.join(layer_path, SCRIPTS_CANNED_IMAGE_DIR) 62 cpath = os.path.join(layer_path, SCRIPTS_CANNED_IMAGE_DIR)
63 canned_wks_layer_dirs.append(path) 63 canned_wks_layer_dirs.append(cpath)
64 64
65 path = os.path.join(dl, CANNED_IMAGE_DIR) 65 cpath = os.path.join(path, CANNED_IMAGE_DIR)
66 canned_wks_layer_dirs.append(path) 66 canned_wks_layer_dirs.append(cpath)
67 67
68 return canned_wks_layer_dirs 68 return canned_wks_layer_dirs
69 69
@@ -99,14 +99,13 @@ def list_canned_images(scripts_path):
99 continue 99 continue
100 if fname.endswith(".wks"): 100 if fname.endswith(".wks"):
101 fullpath = os.path.join(canned_wks_dir, fname) 101 fullpath = os.path.join(canned_wks_dir, fname)
102 f = open(fullpath, "r") 102 with open(fullpath) as wks:
103 lines = f.readlines() 103 for line in wks:
104 for line in lines: 104 desc = ""
105 desc = "" 105 idx = line.find("short-description:")
106 idx = line.find("short-description:") 106 if idx != -1:
107 if idx != -1: 107 desc = line[idx + len("short-description:"):].strip()
108 desc = line[idx + len("short-description:"):].strip() 108 break
109 break
110 basename = os.path.splitext(fname)[0] 109 basename = os.path.splitext(fname)[0]
111 print " %s\t\t%s" % (basename.ljust(30), desc) 110 print " %s\t\t%s" % (basename.ljust(30), desc)
112 111
@@ -115,24 +114,23 @@ def list_canned_image_help(scripts_path, fullpath):
115 """ 114 """
116 List the help and params in the specified canned image. 115 List the help and params in the specified canned image.
117 """ 116 """
118 f = open(fullpath, "r")
119 lines = f.readlines()
120 found = False 117 found = False
121 for line in lines: 118 with open(fullpath) as wks:
122 if not found: 119 for line in wks:
123 idx = line.find("long-description:") 120 if not found:
121 idx = line.find("long-description:")
122 if idx != -1:
123 print
124 print line[idx + len("long-description:"):].strip()
125 found = True
126 continue
127 if not line.strip():
128 break
129 idx = line.find("#")
124 if idx != -1: 130 if idx != -1:
125 print 131 print line[idx + len("#:"):].rstrip()
126 print line[idx + len("long-description:"):].strip() 132 else:
127 found = True 133 break
128 continue
129 if not line.strip():
130 break
131 idx = line.find("#")
132 if idx != -1:
133 print line[idx + len("#:"):].rstrip()
134 else:
135 break
136 134
137 135
138def list_source_plugins(): 136def list_source_plugins():
@@ -186,10 +184,10 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
186 if debug: 184 if debug:
187 msger.set_loglevel('debug') 185 msger.set_loglevel('debug')
188 186
189 cr = creator.Creator() 187 crobj = creator.Creator()
190 188
191 cr.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, 189 crobj.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir,
192 wks_file, image_output_dir, oe_builddir, compressor or ""]) 190 wks_file, image_output_dir, oe_builddir, compressor or ""])
193 191
194 print "\nThe image(s) were created using OE kickstart file:\n %s" % wks_file 192 print "\nThe image(s) were created using OE kickstart file:\n %s" % wks_file
195 193