summaryrefslogtreecommitdiffstats
path: root/scripts/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-05-04 16:06:14 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-14 07:26:41 +0100
commitee6979a19c77931c3cf6368e695e370d46192fef (patch)
tree6172895493cc702eb9a97c0cc0a848c93bedb136 /scripts/wic
parent1cb484ab99eabb5c24792757ab09d7f170f2e614 (diff)
downloadopenembedded-core-contrib-ee6979a19c77931c3cf6368e695e370d46192fef.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] Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/wic')
-rwxr-xr-xscripts/wic43
1 files changed, 22 insertions, 21 deletions
diff --git a/scripts/wic b/scripts/wic
index 2286f20a96e..11c8316b97b 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -28,6 +28,7 @@
# AUTHORS
# Tom Zanussi <tom.zanussi (at] linux.intel.com>
#
+from __future__ import print_function
__version__ = "0.2.0"
@@ -140,8 +141,8 @@ def wic_create_subcommand(args, usage_str):
if not val:
missed.append(opt)
if missed:
- print "The following build artifacts are not specified:"
- print " " + ", ".join(missed)
+ print("The following build artifacts are not specified:")
+ print(" " + ", ".join(missed))
sys.exit(1)
if options.image_name:
@@ -153,12 +154,12 @@ def wic_create_subcommand(args, usage_str):
BB_VARS.vars_dir = options.vars_dir
if options.build_check:
- print "Checking basic build environment..."
+ print("Checking basic build environment...")
if not engine.verify_build_env():
- print "Couldn't verify build environment, exiting\n"
+ print("Couldn't verify build environment, exiting\n")
sys.exit(1)
else:
- print "Done.\n"
+ print("Done.\n")
bootimg_dir = ""
@@ -168,7 +169,7 @@ def wic_create_subcommand(args, usage_str):
if options.debug:
argv.append("--debug")
- print "Building rootfs...\n"
+ print("Building rootfs...\n")
if bitbake_main(BitBakeConfigParameters(argv),
cookerdata.CookerConfiguration()):
sys.exit(1)
@@ -179,7 +180,7 @@ def wic_create_subcommand(args, usage_str):
options.image_name)
else:
if options.build_rootfs:
- print "Image name is not specified, exiting. (Use -e/--image-name to specify it)\n"
+ print("Image name is not specified, exiting. (Use -e/--image-name to specify it)\n")
sys.exit(1)
wks_file = args[0]
@@ -187,9 +188,9 @@ def wic_create_subcommand(args, usage_str):
if not wks_file.endswith(".wks"):
wks_file = engine.find_canned_image(scripts_path, wks_file)
if not wks_file:
- print "No image named %s found, exiting. (Use 'wic list images' "\
+ print("No image named %s found, exiting. (Use 'wic list images' "\
"to list available images, or specify a fully-qualified OE "\
- "kickstart (.wks) filename)\n" % args[0]
+ "kickstart (.wks) filename)\n" % args[0])
sys.exit(1)
image_output_dir = ""
@@ -204,16 +205,16 @@ def wic_create_subcommand(args, usage_str):
kernel_dir = options.kernel_dir
native_sysroot = options.native_sysroot
if rootfs_dir and not os.path.isdir(rootfs_dir):
- print "--roofs-dir (-r) not found, exiting\n"
+ print("--roofs-dir (-r) not found, exiting\n")
sys.exit(1)
if not os.path.isdir(bootimg_dir):
- print "--bootimg-dir (-b) not found, exiting\n"
+ print("--bootimg-dir (-b) not found, exiting\n")
sys.exit(1)
if not os.path.isdir(kernel_dir):
- print "--kernel-dir (-k) not found, exiting\n"
+ print("--kernel-dir (-k) not found, exiting\n")
sys.exit(1)
if not os.path.isdir(native_sysroot):
- print "--native-sysroot (-n) not found, exiting\n"
+ print("--native-sysroot (-n) not found, exiting\n")
sys.exit(1)
else:
not_found = not_found_dir = ""
@@ -226,12 +227,12 @@ def wic_create_subcommand(args, usage_str):
if not_found:
if not not_found_dir:
not_found_dir = "Completely missing artifact - wrong image (.wks) used?"
- print "Build artifacts not found, exiting."
- print " (Please check that the build artifacts for the machine"
- print " selected in local.conf actually exist and that they"
- print " are the correct artifacts for the image (.wks file)).\n"
- print "The artifact that couldn't be found was %s:\n %s" % \
- (not_found, not_found_dir)
+ print("Build artifacts not found, exiting.")
+ print(" (Please check that the build artifacts for the machine")
+ print(" selected in local.conf actually exist and that they")
+ print(" are the correct artifacts for the image (.wks file)).\n")
+ print("The artifact that couldn't be found was %s:\n %s" % \
+ (not_found, not_found_dir))
sys.exit(1)
krootfs_dir = options.rootfs_dir
@@ -241,7 +242,7 @@ def wic_create_subcommand(args, usage_str):
rootfs_dir = rootfs_dir_to_args(krootfs_dir)
- print "Creating image(s)...\n"
+ print("Creating image(s)...\n")
engine.wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir,
native_sysroot, scripts_path, image_output_dir,
options.compressor, options.debug)
@@ -318,6 +319,6 @@ if __name__ == "__main__":
try:
sys.exit(main(sys.argv[1:]))
except WicError as err:
- print >> sys.stderr, "ERROR:", err
+ print("ERROR:", err, file=sys.stderr)
sys.exit(1)