diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-05-04 16:06:14 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-14 23:05:13 +0100 |
commit | 0c57dd96c85612e2c616966ae21fcbbb11bdc066 (patch) | |
tree | 4895dd1b43faf418375d4fdf2d91745ac34d302f /scripts/lib/wic | |
parent | 4dadbbdd46195fc60cd91f589102bca31cea3c2e (diff) | |
download | poky-0c57dd96c85612e2c616966ae21fcbbb11bdc066.tar.gz |
wic: replace print statements with print function
Print statements have been replaced with print function in
Python 3. Replaced them in wic code to be able to run it
under both Python 2 and Python 3.
[YOCTO #9412]
(From OE-Core rev: ee6979a19c77931c3cf6368e695e370d46192fef)
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')
-rw-r--r-- | scripts/lib/wic/engine.py | 20 | ||||
-rw-r--r-- | scripts/lib/wic/help.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/utils/oe/misc.py | 8 |
3 files changed, 15 insertions, 15 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 76b93e82f2..5d35c46b32 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
@@ -44,7 +44,7 @@ def verify_build_env(): | |||
44 | Returns True if it is, false otherwise | 44 | Returns True if it is, false otherwise |
45 | """ | 45 | """ |
46 | if not os.environ.get("BUILDDIR"): | 46 | if not os.environ.get("BUILDDIR"): |
47 | print "BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)" | 47 | print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") |
48 | sys.exit(1) | 48 | sys.exit(1) |
49 | 49 | ||
50 | return True | 50 | return True |
@@ -107,7 +107,7 @@ def list_canned_images(scripts_path): | |||
107 | desc = line[idx + len("short-description:"):].strip() | 107 | desc = line[idx + len("short-description:"):].strip() |
108 | break | 108 | break |
109 | basename = os.path.splitext(fname)[0] | 109 | basename = os.path.splitext(fname)[0] |
110 | print " %s\t\t%s" % (basename.ljust(30), desc) | 110 | print(" %s\t\t%s" % (basename.ljust(30), desc)) |
111 | 111 | ||
112 | 112 | ||
113 | def list_canned_image_help(scripts_path, fullpath): | 113 | def list_canned_image_help(scripts_path, fullpath): |
@@ -120,15 +120,15 @@ def list_canned_image_help(scripts_path, fullpath): | |||
120 | if not found: | 120 | if not found: |
121 | idx = line.find("long-description:") | 121 | idx = line.find("long-description:") |
122 | if idx != -1: | 122 | if idx != -1: |
123 | 123 | print() | |
124 | print line[idx + len("long-description:"):].strip() | 124 | print(line[idx + len("long-description:"):].strip()) |
125 | found = True | 125 | found = True |
126 | continue | 126 | continue |
127 | if not line.strip(): | 127 | if not line.strip(): |
128 | break | 128 | break |
129 | idx = line.find("#") | 129 | idx = line.find("#") |
130 | if idx != -1: | 130 | if idx != -1: |
131 | print line[idx + len("#:"):].rstrip() | 131 | print(line[idx + len("#:"):].rstrip()) |
132 | else: | 132 | else: |
133 | break | 133 | break |
134 | 134 | ||
@@ -140,7 +140,7 @@ def list_source_plugins(): | |||
140 | plugins = pluginmgr.get_source_plugins() | 140 | plugins = pluginmgr.get_source_plugins() |
141 | 141 | ||
142 | for plugin in plugins: | 142 | for plugin in plugins: |
143 | print " %s" % plugin | 143 | print(" %s" % plugin) |
144 | 144 | ||
145 | 145 | ||
146 | def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, | 146 | def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, |
@@ -178,7 +178,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, | |||
178 | try: | 178 | try: |
179 | oe_builddir = os.environ["BUILDDIR"] | 179 | oe_builddir = os.environ["BUILDDIR"] |
180 | except KeyError: | 180 | except KeyError: |
181 | print "BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)" | 181 | print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)") |
182 | sys.exit(1) | 182 | sys.exit(1) |
183 | 183 | ||
184 | if debug: | 184 | if debug: |
@@ -189,7 +189,7 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, | |||
189 | crobj.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, | 189 | crobj.main(["direct", native_sysroot, kernel_dir, bootimg_dir, rootfs_dir, |
190 | wks_file, image_output_dir, oe_builddir, compressor or ""]) | 190 | wks_file, image_output_dir, oe_builddir, compressor or ""]) |
191 | 191 | ||
192 | 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) |
193 | 193 | ||
194 | 194 | ||
195 | def wic_list(args, scripts_path): | 195 | def wic_list(args, scripts_path): |
@@ -209,10 +209,10 @@ def wic_list(args, scripts_path): | |||
209 | wks_file = args[0] | 209 | wks_file = args[0] |
210 | fullpath = find_canned_image(scripts_path, wks_file) | 210 | fullpath = find_canned_image(scripts_path, wks_file) |
211 | if not fullpath: | 211 | if not fullpath: |
212 | print "No image named %s found, exiting. "\ | 212 | print("No image named %s found, exiting. "\ |
213 | "(Use 'wic list images' to list available images, or "\ | 213 | "(Use 'wic list images' to list available images, or "\ |
214 | "specify a fully-qualified OE kickstart (.wks) "\ | 214 | "specify a fully-qualified OE kickstart (.wks) "\ |
215 | "filename)\n" % wks_file | 215 | "filename)\n" % wks_file) |
216 | sys.exit(1) | 216 | sys.exit(1) |
217 | list_canned_image_help(scripts_path, fullpath) | 217 | list_canned_image_help(scripts_path, fullpath) |
218 | return True | 218 | return True |
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index 394e3fde2d..158b6c1ae0 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py | |||
@@ -55,7 +55,7 @@ def wic_help(args, usage_str, subcommands): | |||
55 | Subcommand help dispatcher. | 55 | Subcommand help dispatcher. |
56 | """ | 56 | """ |
57 | if len(args) == 1 or not display_help(args[1], subcommands): | 57 | if len(args) == 1 or not display_help(args[1], subcommands): |
58 | print usage_str | 58 | print(usage_str) |
59 | 59 | ||
60 | 60 | ||
61 | def get_wic_plugins_help(): | 61 | def get_wic_plugins_help(): |
diff --git a/scripts/lib/wic/utils/oe/misc.py b/scripts/lib/wic/utils/oe/misc.py index a3cbe5f1e2..11209be58e 100644 --- a/scripts/lib/wic/utils/oe/misc.py +++ b/scripts/lib/wic/utils/oe/misc.py | |||
@@ -187,8 +187,8 @@ class BitbakeVars(defaultdict): | |||
187 | for line in varsfile: | 187 | for line in varsfile: |
188 | self._parse_line(line, image) | 188 | self._parse_line(line, image) |
189 | else: | 189 | else: |
190 | print "Couldn't get bitbake variable from %s." % fname | 190 | print("Couldn't get bitbake variable from %s." % fname) |
191 | print "File %s doesn't exist." % fname | 191 | print("File %s doesn't exist." % fname) |
192 | return | 192 | return |
193 | else: | 193 | else: |
194 | # Get bitbake -e output | 194 | # Get bitbake -e output |
@@ -202,8 +202,8 @@ class BitbakeVars(defaultdict): | |||
202 | msger.set_loglevel(log_level) | 202 | msger.set_loglevel(log_level) |
203 | 203 | ||
204 | if ret: | 204 | if ret: |
205 | print "Couldn't get '%s' output." % cmd | 205 | print("Couldn't get '%s' output." % cmd) |
206 | print "Bitbake failed with error:\n%s\n" % lines | 206 | print("Bitbake failed with error:\n%s\n" % lines) |
207 | return | 207 | return |
208 | 208 | ||
209 | # Parse bitbake -e output | 209 | # Parse bitbake -e output |