summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-05-30 18:14:46 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-01 12:47:10 +0100
commitab75075e7941c8c2ec429c180976702cd311c978 (patch)
tree981a4f1deb59ae35e0d632134878e70afd55ab75 /scripts
parentfc79776fffa8e15189d3591ef3e291adb39fcb92 (diff)
downloadpoky-ab75075e7941c8c2ec429c180976702cd311c978.tar.gz
scripts: python3: Use print function
Used print function instead of print statement to make the code work in python 3. (From meta-yocto rev: d6eea5a794dd8802b773a9186479a863847e6e55) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/bsp/engine.py38
-rw-r--r--scripts/lib/bsp/kernel.py133
-rwxr-xr-xscripts/yocto-bsp12
3 files changed, 91 insertions, 92 deletions
diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py
index 66e2162ea8..3ab4295d24 100644
--- a/scripts/lib/bsp/engine.py
+++ b/scripts/lib/bsp/engine.py
@@ -1263,13 +1263,13 @@ def conditional_filename(filename):
1263 return None 1263 return None
1264 end = filename.find(CLOSE_TAG, opentag_start) 1264 end = filename.find(CLOSE_TAG, opentag_start)
1265 if end == -1: 1265 if end == -1:
1266 print "No close tag found for open tag in filename %s" % filename 1266 print("No close tag found for open tag in filename %s" % filename)
1267 sys.exit(1) 1267 sys.exit(1)
1268 1268
1269 # we have a {{ tag i.e. code 1269 # we have a {{ tag i.e. code
1270 tag = filename[opentag_start + len(OPEN_TAG):end].strip() 1270 tag = filename[opentag_start + len(OPEN_TAG):end].strip()
1271 if not tag.lstrip().startswith(IF_TAG): 1271 if not tag.lstrip().startswith(IF_TAG):
1272 print "Only 'if' tags are allowed in file or directory names, filename: %s" % filename 1272 print("Only 'if' tags are allowed in file or directory names, filename: %s" % filename)
1273 sys.exit(1) 1273 sys.exit(1)
1274 1274
1275 return CodeLine(tag) 1275 return CodeLine(tag)
@@ -1515,7 +1515,7 @@ def expand_targets(context, bsp_output_dir, expand_common=True):
1515 1515
1516 arches = os.listdir(arch_path) 1516 arches = os.listdir(arch_path)
1517 if arch not in arches or arch == "common": 1517 if arch not in arches or arch == "common":
1518 print "Invalid karch, exiting\n" 1518 print("Invalid karch, exiting\n")
1519 sys.exit(1) 1519 sys.exit(1)
1520 1520
1521 target = os.path.join(arch_path, arch) 1521 target = os.path.join(arch_path, arch)
@@ -1541,7 +1541,7 @@ def yocto_common_create(machine, target, scripts_path, layer_output_dir, codedum
1541 expand_common - boolean, use the contents of (for bsp layers) arch/common 1541 expand_common - boolean, use the contents of (for bsp layers) arch/common
1542 """ 1542 """
1543 if os.path.exists(layer_output_dir): 1543 if os.path.exists(layer_output_dir):
1544 print "\nlayer output dir already exists, exiting. (%s)" % layer_output_dir 1544 print("\nlayer output dir already exists, exiting. (%s)" % layer_output_dir)
1545 sys.exit(1) 1545 sys.exit(1)
1546 1546
1547 properties = None 1547 properties = None
@@ -1550,7 +1550,7 @@ def yocto_common_create(machine, target, scripts_path, layer_output_dir, codedum
1550 try: 1550 try:
1551 infile = open(properties_file, "r") 1551 infile = open(properties_file, "r")
1552 except IOError: 1552 except IOError:
1553 print "Couldn't open properties file %s for reading, exiting" % properties_file 1553 print("Couldn't open properties file %s for reading, exiting" % properties_file)
1554 sys.exit(1) 1554 sys.exit(1)
1555 1555
1556 properties = json.load(infile) 1556 properties = json.load(infile)
@@ -1597,8 +1597,8 @@ def yocto_layer_create(layer_name, scripts_path, layer_output_dir, codedump, pro
1597 """ 1597 """
1598 yocto_common_create(layer_name, "layer", scripts_path, layer_output_dir, codedump, properties_file, properties, False) 1598 yocto_common_create(layer_name, "layer", scripts_path, layer_output_dir, codedump, properties_file, properties, False)
1599 1599
1600 print "\nNew layer created in %s.\n" % (layer_output_dir) 1600 print("\nNew layer created in %s.\n" % layer_output_dir)
1601 print "Don't forget to add it to your BBLAYERS (for details see %s/README)." % (layer_output_dir) 1601 print("Don't forget to add it to your BBLAYERS (for details see %s/README)." % layer_output_dir)
1602 1602
1603 1603
1604def yocto_bsp_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file, properties=None): 1604def yocto_bsp_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file, properties=None):
@@ -1616,7 +1616,7 @@ def yocto_bsp_create(machine, arch, scripts_path, bsp_output_dir, codedump, prop
1616 """ 1616 """
1617 yocto_common_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file, properties) 1617 yocto_common_create(machine, arch, scripts_path, bsp_output_dir, codedump, properties_file, properties)
1618 1618
1619 print "\nNew %s BSP created in %s" % (arch, bsp_output_dir) 1619 print("\nNew %s BSP created in %s" % arch, bsp_output_dir)
1620 1620
1621 1621
1622def print_dict(items, indent = 0): 1622def print_dict(items, indent = 0):
@@ -1624,13 +1624,13 @@ def print_dict(items, indent = 0):
1624 Print the values in a possibly nested dictionary. 1624 Print the values in a possibly nested dictionary.
1625 """ 1625 """
1626 for key, val in items.iteritems(): 1626 for key, val in items.iteritems():
1627 print " "*indent + "\"%s\" :" % key, 1627 print(" "*indent + "\"%s\" :" % key)
1628 if type(val) == dict: 1628 if type(val) == dict:
1629 print "{" 1629 print("{")
1630 print_dict(val, indent + 1) 1630 print_dict(val, indent + 1)
1631 print " "*indent + "}" 1631 print(" "*indent + "}")
1632 else: 1632 else:
1633 print "%s" % val 1633 print("%s" % val)
1634 1634
1635 1635
1636def get_properties(input_lines): 1636def get_properties(input_lines):
@@ -1681,7 +1681,7 @@ def yocto_layer_list_properties(arch, scripts_path, properties_file, expand_comm
1681 try: 1681 try:
1682 of = open(properties_file, "w") 1682 of = open(properties_file, "w")
1683 except IOError: 1683 except IOError:
1684 print "Couldn't open properties file %s for writing, exiting" % properties_file 1684 print("Couldn't open properties file %s for writing, exiting" % properties_file)
1685 sys.exit(1) 1685 sys.exit(1)
1686 1686
1687 json.dump(properties, of, indent=1) 1687 json.dump(properties, of, indent=1)
@@ -1755,10 +1755,10 @@ def print_values(type, values_list):
1755 """ 1755 """
1756 if type == "choicelist": 1756 if type == "choicelist":
1757 for value in values_list: 1757 for value in values_list:
1758 print "[\"%s\", \"%s\"]" % (value[0], value[1]) 1758 print("[\"%s\", \"%s\"]" % (value[0], value[1]))
1759 elif type == "boolean": 1759 elif type == "boolean":
1760 for value in values_list: 1760 for value in values_list:
1761 print "[\"%s\", \"%s\"]" % (value[0], value[1]) 1761 print("[\"%s\", \"%s\"]" % (value[0], value[1]))
1762 1762
1763 1763
1764def yocto_layer_list_property_values(arch, property, scripts_path, properties_file, expand_common=True): 1764def yocto_layer_list_property_values(arch, property, scripts_path, properties_file, expand_common=True):
@@ -1789,7 +1789,7 @@ def yocto_layer_list_property_values(arch, property, scripts_path, properties_fi
1789 1789
1790 input_line = find_input_line(property, input_lines) 1790 input_line = find_input_line(property, input_lines)
1791 if not input_line: 1791 if not input_line:
1792 print "Couldn't find values for property %s" % property 1792 print("Couldn't find values for property %s" % property)
1793 return 1793 return
1794 1794
1795 values_list = [] 1795 values_list = []
@@ -1818,7 +1818,7 @@ def yocto_layer_list_property_values(arch, property, scripts_path, properties_fi
1818 try: 1818 try:
1819 of = open(properties_file, "w") 1819 of = open(properties_file, "w")
1820 except IOError: 1820 except IOError:
1821 print "Couldn't open properties file %s for writing, exiting" % properties_file 1821 print("Couldn't open properties file %s for writing, exiting" % properties_file)
1822 sys.exit(1) 1822 sys.exit(1)
1823 1823
1824 json.dump(values_list, of) 1824 json.dump(values_list, of)
@@ -1839,11 +1839,11 @@ def yocto_bsp_list(args, scripts_path, properties_file):
1839 lib_path = scripts_path + '/lib' 1839 lib_path = scripts_path + '/lib'
1840 bsp_path = lib_path + '/bsp' 1840 bsp_path = lib_path + '/bsp'
1841 arch_path = bsp_path + '/substrate/target/arch' 1841 arch_path = bsp_path + '/substrate/target/arch'
1842 print "Architectures available:" 1842 print("Architectures available:")
1843 for arch in os.listdir(arch_path): 1843 for arch in os.listdir(arch_path):
1844 if arch == "common" or arch == "layer": 1844 if arch == "common" or arch == "layer":
1845 continue 1845 continue
1846 print " %s" % arch 1846 print(" %s" % arch)
1847 return True 1847 return True
1848 else: 1848 else:
1849 arch = args[0] 1849 arch = args[0]
diff --git a/scripts/lib/bsp/kernel.py b/scripts/lib/bsp/kernel.py
index 07832282c3..5bfa663809 100644
--- a/scripts/lib/bsp/kernel.py
+++ b/scripts/lib/bsp/kernel.py
@@ -42,7 +42,7 @@ def find_bblayers():
42 try: 42 try:
43 builddir = os.environ["BUILDDIR"] 43 builddir = os.environ["BUILDDIR"]
44 except KeyError: 44 except KeyError:
45 print "BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)" 45 print("BUILDDIR not found, exiting. (Did you forget to source oe-init-build-env?)")
46 sys.exit(1) 46 sys.exit(1)
47 bblayers_conf = os.path.join(builddir, "conf/bblayers.conf") 47 bblayers_conf = os.path.join(builddir, "conf/bblayers.conf")
48 48
@@ -53,7 +53,7 @@ def find_bblayers():
53 stdout=subprocess.PIPE).stdout.read() 53 stdout=subprocess.PIPE).stdout.read()
54 54
55 if not bitbake_env_lines: 55 if not bitbake_env_lines:
56 print "Couldn't get '%s' output, exiting." % bitbake_env_cmd 56 print("Couldn't get '%s' output, exiting." % bitbake_env_cmd)
57 sys.exit(1) 57 sys.exit(1)
58 58
59 for line in bitbake_env_lines.split('\n'): 59 for line in bitbake_env_lines.split('\n'):
@@ -62,8 +62,7 @@ def find_bblayers():
62 break 62 break
63 63
64 if not bblayers: 64 if not bblayers:
65 print "Couldn't find BBLAYERS in %s output, exiting." % \ 65 print("Couldn't find BBLAYERS in %s output, exiting." % bitbake_env_cmd)
66 bitbake_env_cmd
67 sys.exit(1) 66 sys.exit(1)
68 67
69 raw_layers = bblayers.split() 68 raw_layers = bblayers.split()
@@ -110,8 +109,8 @@ def find_bsp_layer(machine):
110 if layer.endswith(machine): 109 if layer.endswith(machine):
111 return layer 110 return layer
112 111
113 print "Unable to find the BSP layer for machine %s." % machine 112 print("Unable to find the BSP layer for machine %s." % machine)
114 print "Please make sure it is listed in bblayers.conf" 113 print("Please make sure it is listed in bblayers.conf")
115 sys.exit(1) 114 sys.exit(1)
116 115
117 116
@@ -190,8 +189,8 @@ def yocto_kernel_config_list(scripts_path, machine):
190 """ 189 """
191 config_items = read_config_items(scripts_path, machine) 190 config_items = read_config_items(scripts_path, machine)
192 191
193 print "The current set of machine-specific kernel config items for %s is:" % machine 192 print("The current set of machine-specific kernel config items for %s is:" % machine)
194 print gen_choices_str(config_items) 193 print(gen_choices_str(config_items))
195 194
196 195
197def yocto_kernel_config_rm(scripts_path, machine): 196def yocto_kernel_config_rm(scripts_path, machine):
@@ -202,7 +201,7 @@ def yocto_kernel_config_rm(scripts_path, machine):
202 """ 201 """
203 config_items = read_config_items(scripts_path, machine) 202 config_items = read_config_items(scripts_path, machine)
204 203
205 print "Specify the kernel config items to remove:" 204 print("Specify the kernel config items to remove:")
206 input = raw_input(gen_choices_str(config_items)) 205 input = raw_input(gen_choices_str(config_items))
207 rm_choices = input.split() 206 rm_choices = input.split()
208 rm_choices.sort() 207 rm_choices.sort()
@@ -213,18 +212,18 @@ def yocto_kernel_config_rm(scripts_path, machine):
213 try: 212 try:
214 idx = int(choice) - 1 213 idx = int(choice) - 1
215 except ValueError: 214 except ValueError:
216 print "Invalid choice (%s), exiting" % choice 215 print("Invalid choice (%s), exiting" % choice)
217 sys.exit(1) 216 sys.exit(1)
218 if idx < 0 or idx >= len(config_items): 217 if idx < 0 or idx >= len(config_items):
219 print "Invalid choice (%d), exiting" % (idx + 1) 218 print("Invalid choice (%d), exiting" % (idx + 1))
220 sys.exit(1) 219 sys.exit(1)
221 removed.append(config_items.pop(idx)) 220 removed.append(config_items.pop(idx))
222 221
223 write_config_items(scripts_path, machine, config_items) 222 write_config_items(scripts_path, machine, config_items)
224 223
225 print "Removed items:" 224 print("Removed items:")
226 for r in removed: 225 for r in removed:
227 print "\t%s" % r 226 print("\t%s" % r)
228 227
229 228
230def yocto_kernel_config_add(scripts_path, machine, config_items): 229def yocto_kernel_config_add(scripts_path, machine, config_items):
@@ -239,7 +238,7 @@ def yocto_kernel_config_add(scripts_path, machine, config_items):
239 238
240 for item in config_items: 239 for item in config_items:
241 if not item.startswith("CONFIG") or (not "=y" in item and not "=m" in item): 240 if not item.startswith("CONFIG") or (not "=y" in item and not "=m" in item):
242 print "Invalid config item (%s), exiting" % item 241 print("Invalid config item (%s), exiting" % item)
243 sys.exit(1) 242 sys.exit(1)
244 if item not in cur_items and item not in new_items: 243 if item not in cur_items and item not in new_items:
245 new_items.append(item) 244 new_items.append(item)
@@ -249,16 +248,16 @@ def yocto_kernel_config_add(scripts_path, machine, config_items):
249 if len(new_items) > 0: 248 if len(new_items) > 0:
250 cur_items.extend(new_items) 249 cur_items.extend(new_items)
251 write_config_items(scripts_path, machine, cur_items) 250 write_config_items(scripts_path, machine, cur_items)
252 print "Added item%s:" % ("" if len(new_items)==1 else "s") 251 print("Added item%s:" % ("" if len(new_items)==1 else "s"))
253 for n in new_items: 252 for n in new_items:
254 print "\t%s" % n 253 print("\t%s" % n)
255 254
256 if len(dup_items) > 0: 255 if len(dup_items) > 0:
257 output="The following item%s already exist%s in the current configuration, ignoring %s:" % \ 256 output="The following item%s already exist%s in the current configuration, ignoring %s:" % \
258 (("","s", "it") if len(dup_items)==1 else ("s", "", "them" )) 257 (("","s", "it") if len(dup_items)==1 else ("s", "", "them" ))
259 print output 258 print(output)
260 for n in dup_items: 259 for n in dup_items:
261 print "\t%s" % n 260 print("\t%s" % n)
262 261
263def find_current_kernel(bsp_layer, machine): 262def find_current_kernel(bsp_layer, machine):
264 """ 263 """
@@ -348,8 +347,8 @@ def yocto_kernel_patch_list(scripts_path, machine):
348 """ 347 """
349 patches = read_patch_items(scripts_path, machine) 348 patches = read_patch_items(scripts_path, machine)
350 349
351 print "The current set of machine-specific patches for %s is:" % machine 350 print("The current set of machine-specific patches for %s is:" % machine)
352 print gen_choices_str(patches) 351 print(gen_choices_str(patches))
353 352
354 353
355def yocto_kernel_patch_rm(scripts_path, machine): 354def yocto_kernel_patch_rm(scripts_path, machine):
@@ -359,7 +358,7 @@ def yocto_kernel_patch_rm(scripts_path, machine):
359 """ 358 """
360 patches = read_patch_items(scripts_path, machine) 359 patches = read_patch_items(scripts_path, machine)
361 360
362 print "Specify the patches to remove:" 361 print("Specify the patches to remove:")
363 input = raw_input(gen_choices_str(patches)) 362 input = raw_input(gen_choices_str(patches))
364 rm_choices = input.split() 363 rm_choices = input.split()
365 rm_choices.sort() 364 rm_choices.sort()
@@ -368,17 +367,17 @@ def yocto_kernel_patch_rm(scripts_path, machine):
368 367
369 filesdir = find_filesdir(scripts_path, machine) 368 filesdir = find_filesdir(scripts_path, machine)
370 if not filesdir: 369 if not filesdir:
371 print "Couldn't rm patch(es) since we couldn't find a 'files' dir" 370 print("Couldn't rm patch(es) since we couldn't find a 'files' dir")
372 sys.exit(1) 371 sys.exit(1)
373 372
374 for choice in reversed(rm_choices): 373 for choice in reversed(rm_choices):
375 try: 374 try:
376 idx = int(choice) - 1 375 idx = int(choice) - 1
377 except ValueError: 376 except ValueError:
378 print "Invalid choice (%s), exiting" % choice 377 print("Invalid choice (%s), exiting" % choice)
379 sys.exit(1) 378 sys.exit(1)
380 if idx < 0 or idx >= len(patches): 379 if idx < 0 or idx >= len(patches):
381 print "Invalid choice (%d), exiting" % (idx + 1) 380 print("Invalid choice (%d), exiting" % (idx + 1))
382 sys.exit(1) 381 sys.exit(1)
383 filesdir_patch = os.path.join(filesdir, patches[idx]) 382 filesdir_patch = os.path.join(filesdir, patches[idx])
384 if os.path.isfile(filesdir_patch): 383 if os.path.isfile(filesdir_patch):
@@ -388,9 +387,9 @@ def yocto_kernel_patch_rm(scripts_path, machine):
388 387
389 write_patch_items(scripts_path, machine, patches) 388 write_patch_items(scripts_path, machine, patches)
390 389
391 print "Removed patches:" 390 print("Removed patches:")
392 for r in removed: 391 for r in removed:
393 print "\t%s" % r 392 print("\t%s" % r)
394 393
395 394
396def yocto_kernel_patch_add(scripts_path, machine, patches): 395def yocto_kernel_patch_add(scripts_path, machine, patches):
@@ -402,19 +401,19 @@ def yocto_kernel_patch_add(scripts_path, machine, patches):
402 401
403 for patch in patches: 402 for patch in patches:
404 if os.path.basename(patch) in existing_patches: 403 if os.path.basename(patch) in existing_patches:
405 print "Couldn't add patch (%s) since it's already been added" % os.path.basename(patch) 404 print("Couldn't add patch (%s) since it's already been added" % os.path.basename(patch))
406 sys.exit(1) 405 sys.exit(1)
407 406
408 filesdir = find_filesdir(scripts_path, machine) 407 filesdir = find_filesdir(scripts_path, machine)
409 if not filesdir: 408 if not filesdir:
410 print "Couldn't add patch (%s) since we couldn't find a 'files' dir to add it to" % os.path.basename(patch) 409 print("Couldn't add patch (%s) since we couldn't find a 'files' dir to add it to" % os.path.basename(patch))
411 sys.exit(1) 410 sys.exit(1)
412 411
413 new_patches = [] 412 new_patches = []
414 413
415 for patch in patches: 414 for patch in patches:
416 if not os.path.isfile(patch): 415 if not os.path.isfile(patch):
417 print "Couldn't find patch (%s), exiting" % patch 416 print("Couldn't find patch (%s), exiting" % patch)
418 sys.exit(1) 417 sys.exit(1)
419 basename = os.path.basename(patch) 418 basename = os.path.basename(patch)
420 filesdir_patch = os.path.join(filesdir, basename) 419 filesdir_patch = os.path.join(filesdir, basename)
@@ -425,9 +424,9 @@ def yocto_kernel_patch_add(scripts_path, machine, patches):
425 cur_items.extend(new_patches) 424 cur_items.extend(new_patches)
426 write_patch_items(scripts_path, machine, cur_items) 425 write_patch_items(scripts_path, machine, cur_items)
427 426
428 print "Added patches:" 427 print("Added patches:")
429 for n in new_patches: 428 for n in new_patches:
430 print "\t%s" % n 429 print("\t%s" % n)
431 430
432 431
433def inc_pr(line): 432def inc_pr(line):
@@ -462,7 +461,7 @@ def kernel_contents_changed(scripts_path, machine):
462 461
463 kernel = find_current_kernel(layer, machine) 462 kernel = find_current_kernel(layer, machine)
464 if not kernel: 463 if not kernel:
465 print "Couldn't determine the kernel for this BSP, exiting." 464 print("Couldn't determine the kernel for this BSP, exiting.")
466 sys.exit(1) 465 sys.exit(1)
467 466
468 kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend") 467 kernel_bbfile = os.path.join(layer, "recipes-kernel/linux/" + kernel + ".bbappend")
@@ -598,8 +597,8 @@ def yocto_kernel_feature_list(scripts_path, machine):
598 """ 597 """
599 features = read_features(scripts_path, machine) 598 features = read_features(scripts_path, machine)
600 599
601 print "The current set of machine-specific features for %s is:" % machine 600 print("The current set of machine-specific features for %s is:" % machine)
602 print gen_choices_str(features) 601 print(gen_choices_str(features))
603 602
604 603
605def yocto_kernel_feature_rm(scripts_path, machine): 604def yocto_kernel_feature_rm(scripts_path, machine):
@@ -610,7 +609,7 @@ def yocto_kernel_feature_rm(scripts_path, machine):
610 """ 609 """
611 features = read_features(scripts_path, machine) 610 features = read_features(scripts_path, machine)
612 611
613 print "Specify the features to remove:" 612 print("Specify the features to remove:")
614 input = raw_input(gen_choices_str(features)) 613 input = raw_input(gen_choices_str(features))
615 rm_choices = input.split() 614 rm_choices = input.split()
616 rm_choices.sort() 615 rm_choices.sort()
@@ -621,18 +620,18 @@ def yocto_kernel_feature_rm(scripts_path, machine):
621 try: 620 try:
622 idx = int(choice) - 1 621 idx = int(choice) - 1
623 except ValueError: 622 except ValueError:
624 print "Invalid choice (%s), exiting" % choice 623 print("Invalid choice (%s), exiting" % choice)
625 sys.exit(1) 624 sys.exit(1)
626 if idx < 0 or idx >= len(features): 625 if idx < 0 or idx >= len(features):
627 print "Invalid choice (%d), exiting" % (idx + 1) 626 print("Invalid choice (%d), exiting" % (idx + 1))
628 sys.exit(1) 627 sys.exit(1)
629 removed.append(features.pop(idx)) 628 removed.append(features.pop(idx))
630 629
631 write_features(scripts_path, machine, features) 630 write_features(scripts_path, machine, features)
632 631
633 print "Removed features:" 632 print("Removed features:")
634 for r in removed: 633 for r in removed:
635 print "\t%s" % r 634 print("\t%s" % r)
636 635
637 636
638def yocto_kernel_feature_add(scripts_path, machine, features): 637def yocto_kernel_feature_add(scripts_path, machine, features):
@@ -644,7 +643,7 @@ def yocto_kernel_feature_add(scripts_path, machine, features):
644 643
645 for item in features: 644 for item in features:
646 if not item.endswith(".scc"): 645 if not item.endswith(".scc"):
647 print "Invalid feature (%s), exiting" % item 646 print("Invalid feature (%s), exiting" % item)
648 sys.exit(1) 647 sys.exit(1)
649 new_items.append(item) 648 new_items.append(item)
650 649
@@ -653,9 +652,9 @@ def yocto_kernel_feature_add(scripts_path, machine, features):
653 652
654 write_features(scripts_path, machine, cur_items) 653 write_features(scripts_path, machine, cur_items)
655 654
656 print "Added features:" 655 print("Added features:")
657 for n in new_items: 656 for n in new_items:
658 print "\t%s" % n 657 print("\t%s" % n)
659 658
660 659
661def find_feature_url(git_url): 660def find_feature_url(git_url):
@@ -715,7 +714,7 @@ def print_feature_descs(layer, feature_dir):
715 feature_dir + "/" + file) 714 feature_dir + "/" + file)
716 f = open(fullpath) 715 f = open(fullpath)
717 feature_desc = find_feature_desc(f.readlines()) 716 feature_desc = find_feature_desc(f.readlines())
718 print feature_dir + "/" + file + ": " + feature_desc 717 print(feature_dir + "/" + file + ": " + feature_desc)
719 718
720 719
721def yocto_kernel_available_features_list(scripts_path, machine): 720def yocto_kernel_available_features_list(scripts_path, machine):
@@ -726,7 +725,7 @@ def yocto_kernel_available_features_list(scripts_path, machine):
726 layer = find_bsp_layer(machine) 725 layer = find_bsp_layer(machine)
727 kernel = find_current_kernel(layer, machine) 726 kernel = find_current_kernel(layer, machine)
728 if not kernel: 727 if not kernel:
729 print "Couldn't determine the kernel for this BSP, exiting." 728 print("Couldn't determine the kernel for this BSP, exiting.")
730 sys.exit(1) 729 sys.exit(1)
731 730
732 context = create_context(machine, "arch", scripts_path) 731 context = create_context(machine, "arch", scripts_path)
@@ -738,7 +737,7 @@ def yocto_kernel_available_features_list(scripts_path, machine):
738 feature_cmd = "wget -q -O - " + feature_url 737 feature_cmd = "wget -q -O - " + feature_url
739 tmp = subprocess.Popen(feature_cmd, shell=True, stdout=subprocess.PIPE).stdout.read() 738 tmp = subprocess.Popen(feature_cmd, shell=True, stdout=subprocess.PIPE).stdout.read()
740 739
741 print "The current set of kernel features available to %s is:\n" % machine 740 print("The current set of kernel features available to %s is:\n" % machine)
742 741
743 if tmp: 742 if tmp:
744 tmpline = tmp.split("\n") 743 tmpline = tmp.split("\n")
@@ -755,9 +754,9 @@ def yocto_kernel_available_features_list(scripts_path, machine):
755 feature_type = feature_def[0].strip() 754 feature_type = feature_def[0].strip()
756 feature = feature_def[1].strip() 755 feature = feature_def[1].strip()
757 desc = get_feature_desc(giturl, feature) 756 desc = get_feature_desc(giturl, feature)
758 print "%s: %s" % (feature, desc) 757 print("%s: %s" % (feature, desc))
759 758
760 print "[local]" 759 print("[local]")
761 760
762 print_feature_descs(layer, "cfg") 761 print_feature_descs(layer, "cfg")
763 print_feature_descs(layer, "features") 762 print_feature_descs(layer, "features")
@@ -801,7 +800,7 @@ def yocto_kernel_feature_describe(scripts_path, machine, feature):
801 800
802 kernel = find_current_kernel(layer, machine) 801 kernel = find_current_kernel(layer, machine)
803 if not kernel: 802 if not kernel:
804 print "Couldn't determine the kernel for this BSP, exiting." 803 print("Couldn't determine the kernel for this BSP, exiting.")
805 sys.exit(1) 804 sys.exit(1)
806 805
807 context = create_context(machine, "arch", scripts_path) 806 context = create_context(machine, "arch", scripts_path)
@@ -811,7 +810,7 @@ def yocto_kernel_feature_describe(scripts_path, machine, feature):
811 810
812 desc = get_feature_desc(giturl, feature) 811 desc = get_feature_desc(giturl, feature)
813 812
814 print desc 813 print(desc)
815 814
816 815
817def check_feature_name(feature_name): 816def check_feature_name(feature_name):
@@ -819,11 +818,11 @@ def check_feature_name(feature_name):
819 Sanity-check the feature name for create/destroy. Return False if not OK. 818 Sanity-check the feature name for create/destroy. Return False if not OK.
820 """ 819 """
821 if not feature_name.endswith(".scc"): 820 if not feature_name.endswith(".scc"):
822 print "Invalid feature name (must end with .scc) [%s], exiting" % feature_name 821 print("Invalid feature name (must end with .scc) [%s], exiting" % feature_name)
823 return False 822 return False
824 823
825 if "/" in feature_name: 824 if "/" in feature_name:
826 print "Invalid feature name (don't specify directory) [%s], exiting" % feature_name 825 print("Invalid feature name (don't specify directory) [%s], exiting" % feature_name)
827 return False 826 return False
828 827
829 return True 828 return True
@@ -837,11 +836,11 @@ def check_create_input(feature_items):
837 return False 836 return False
838 837
839 if feature_items[1].endswith(".patch") or feature_items[1].startswith("CONFIG_"): 838 if feature_items[1].endswith(".patch") or feature_items[1].startswith("CONFIG_"):
840 print "Missing description and/or compatibilty [%s], exiting" % feature_items[1] 839 print("Missing description and/or compatibilty [%s], exiting" % feature_items[1])
841 return False 840 return False
842 841
843 if feature_items[2].endswith(".patch") or feature_items[2].startswith("CONFIG_"): 842 if feature_items[2].endswith(".patch") or feature_items[2].startswith("CONFIG_"):
844 print "Missing description and/or compatibility [%s], exiting" % feature_items[1] 843 print("Missing description and/or compatibility [%s], exiting" % feature_items[1])
845 return False 844 return False
846 845
847 return True 846 return True
@@ -869,7 +868,7 @@ def yocto_kernel_feature_create(scripts_path, machine, feature_items):
869 if ("=y" in item or "=m" in item): 868 if ("=y" in item or "=m" in item):
870 cfg_items.append(item) 869 cfg_items.append(item)
871 else: 870 else:
872 print "Invalid feature item (must be .patch or CONFIG_*) [%s], exiting" % item 871 print("Invalid feature item (must be .patch or CONFIG_*) [%s], exiting" % item)
873 sys.exit(1) 872 sys.exit(1)
874 873
875 feature_dirname = "cfg" 874 feature_dirname = "cfg"
@@ -878,7 +877,7 @@ def yocto_kernel_feature_create(scripts_path, machine, feature_items):
878 877
879 filesdir = find_filesdir(scripts_path, machine) 878 filesdir = find_filesdir(scripts_path, machine)
880 if not filesdir: 879 if not filesdir:
881 print "Couldn't add feature (%s), no 'files' dir found" % feature 880 print("Couldn't add feature (%s), no 'files' dir found" % feature)
882 sys.exit(1) 881 sys.exit(1)
883 882
884 featdir = os.path.join(filesdir, feature_dirname) 883 featdir = os.path.join(filesdir, feature_dirname)
@@ -887,7 +886,7 @@ def yocto_kernel_feature_create(scripts_path, machine, feature_items):
887 886
888 for patch in patches: 887 for patch in patches:
889 if not os.path.isfile(patch): 888 if not os.path.isfile(patch):
890 print "Couldn't find patch (%s), exiting" % patch 889 print("Couldn't find patch (%s), exiting" % patch)
891 sys.exit(1) 890 sys.exit(1)
892 basename = os.path.basename(patch) 891 basename = os.path.basename(patch)
893 featdir_patch = os.path.join(featdir, basename) 892 featdir_patch = os.path.join(featdir, basename)
@@ -911,8 +910,8 @@ def yocto_kernel_feature_create(scripts_path, machine, feature_items):
911 new_feature_file.write("kconf non-hardware " + feature_basename + ".cfg\n") 910 new_feature_file.write("kconf non-hardware " + feature_basename + ".cfg\n")
912 new_feature_file.close() 911 new_feature_file.close()
913 912
914 print "Added feature:" 913 print("Added feature:")
915 print "\t%s" % feature_dirname + "/" + feature 914 print("\t%s" % feature_dirname + "/" + feature)
916 915
917 916
918def feature_in_use(scripts_path, machine, feature): 917def feature_in_use(scripts_path, machine, feature):
@@ -950,18 +949,18 @@ def yocto_kernel_feature_destroy(scripts_path, machine, feature):
950 949
951 if feature_in_use(scripts_path, machine, "features/" + feature) or \ 950 if feature_in_use(scripts_path, machine, "features/" + feature) or \
952 feature_in_use(scripts_path, machine, "cfg/" + feature): 951 feature_in_use(scripts_path, machine, "cfg/" + feature):
953 print "Feature %s is in use (use 'feature rm' to un-use it first), exiting" % feature 952 print("Feature %s is in use (use 'feature rm' to un-use it first), exiting" % feature)
954 sys.exit(1) 953 sys.exit(1)
955 954
956 filesdir = find_filesdir(scripts_path, machine) 955 filesdir = find_filesdir(scripts_path, machine)
957 if not filesdir: 956 if not filesdir:
958 print "Couldn't destroy feature (%s), no 'files' dir found" % feature 957 print("Couldn't destroy feature (%s), no 'files' dir found" % feature)
959 sys.exit(1) 958 sys.exit(1)
960 959
961 feature_dirname = "features" 960 feature_dirname = "features"
962 featdir = os.path.join(filesdir, feature_dirname) 961 featdir = os.path.join(filesdir, feature_dirname)
963 if not os.path.exists(featdir): 962 if not os.path.exists(featdir):
964 print "Couldn't find feature directory (%s)" % feature_dirname 963 print("Couldn't find feature directory (%s)" % feature_dirname)
965 sys.exit(1) 964 sys.exit(1)
966 965
967 feature_fqn = os.path.join(featdir, feature) 966 feature_fqn = os.path.join(featdir, feature)
@@ -969,11 +968,11 @@ def yocto_kernel_feature_destroy(scripts_path, machine, feature):
969 feature_dirname = "cfg" 968 feature_dirname = "cfg"
970 featdir = os.path.join(filesdir, feature_dirname) 969 featdir = os.path.join(filesdir, feature_dirname)
971 if not os.path.exists(featdir): 970 if not os.path.exists(featdir):
972 print "Couldn't find feature directory (%s)" % feature_dirname 971 print("Couldn't find feature directory (%s)" % feature_dirname)
973 sys.exit(1) 972 sys.exit(1)
974 feature_fqn = os.path.join(featdir, feature_filename) 973 feature_fqn = os.path.join(featdir, feature_filename)
975 if not os.path.exists(feature_fqn): 974 if not os.path.exists(feature_fqn):
976 print "Couldn't find feature (%s)" % feature 975 print("Couldn't find feature (%s)" % feature)
977 sys.exit(1) 976 sys.exit(1)
978 977
979 f = open(feature_fqn, "r") 978 f = open(feature_fqn, "r")
@@ -990,8 +989,8 @@ def yocto_kernel_feature_destroy(scripts_path, machine, feature):
990 989
991 feature_remove(scripts_path, machine, feature) 990 feature_remove(scripts_path, machine, feature)
992 991
993 print "Removed feature:" 992 print("Removed feature:")
994 print "\t%s" % feature_dirname + "/" + feature 993 print("\t%s" % feature_dirname + "/" + feature)
995 994
996 995
997def base_branches(context): 996def base_branches(context):
@@ -1000,7 +999,7 @@ def base_branches(context):
1000 """ 999 """
1001 giturl = find_giturl(context) 1000 giturl = find_giturl(context)
1002 1001
1003 print "Getting branches from remote repo %s..." % giturl 1002 print("Getting branches from remote repo %s..." % giturl)
1004 1003
1005 gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) 1004 gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl)
1006 tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read() 1005 tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read()
@@ -1030,7 +1029,7 @@ def all_branches(context):
1030 """ 1029 """
1031 giturl = find_giturl(context) 1030 giturl = find_giturl(context)
1032 1031
1033 print "Getting branches from remote repo %s..." % giturl 1032 print("Getting branches from remote repo %s..." % giturl)
1034 1033
1035 gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl) 1034 gitcmd = "git ls-remote %s *heads* 2>&1" % (giturl)
1036 tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read() 1035 tmp = subprocess.Popen(gitcmd, shell=True, stdout=subprocess.PIPE).stdout.read()
diff --git a/scripts/yocto-bsp b/scripts/yocto-bsp
index 82a050ebdc..ce30e55334 100755
--- a/scripts/yocto-bsp
+++ b/scripts/yocto-bsp
@@ -76,15 +76,15 @@ def yocto_bsp_create_subcommand(args, usage_str):
76 bsp_output_dir = "meta-" + machine 76 bsp_output_dir = "meta-" + machine
77 77
78 if options.git_check and not options.properties_file: 78 if options.git_check and not options.properties_file:
79 print "Checking basic git connectivity..." 79 print("Checking basic git connectivity...")
80 if not verify_git_repo(GIT_CHECK_URI): 80 if not verify_git_repo(GIT_CHECK_URI):
81 print "Couldn't verify git connectivity, exiting\n" 81 print("Couldn't verify git connectivity, exiting\n")
82 print "Details: couldn't access %s" % GIT_CHECK_URI 82 print("Details: couldn't access %s" % GIT_CHECK_URI)
83 print " (this most likely indicates a network connectivity problem or" 83 print(" (this most likely indicates a network connectivity problem or")
84 print " a misconfigured git intallation)" 84 print(" a misconfigured git intallation)")
85 sys.exit(1) 85 sys.exit(1)
86 else: 86 else:
87 print "Done.\n" 87 print("Done.\n")
88 88
89 yocto_bsp_create(machine, karch, scripts_path, bsp_output_dir, options.codedump, options.properties_file) 89 yocto_bsp_create(machine, karch, scripts_path, bsp_output_dir, options.codedump, options.properties_file)
90 90