Skip to contentSkip to conversation

meta/selftest/scripts: Use print function for python3 compatibility

PATCH New Richard Purdie 1 participant 1 message May 21, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 meta/selftest/scripts: Use print function for python3 compatibility

Used print function instead of print statement to make the code work in python 3.

[Changes from both Ed and Richard]

meta-selftest/lib/devtool/test.py +1 -1
index b7474b5..31190f5 100644
@@ -2,7 +2,7 @@ import argparse
 
 def selftest_reverse(args, config, basepath, workspace):
     """Reverse the value passed to verify the plugin is executing."""
-    print args.value[::-1]
+    print(args.value[::-1])
 
 def register_commands(subparsers, context):
     parser_build = subparsers.add_parser('selftest-reverse', help='Reverse value (for selftest)',
meta/lib/oe/qa.py +1 -1
index 3cfeee7..cc2902f 100644
@@ -148,4 +148,4 @@ if __name__ == "__main__":
     import sys
     elf = ELFFile(sys.argv[1])
     elf.open()
-    print elf.isDynamic()
+    print(elf.isDynamic())
meta/lib/oe/utils.py +1 -1
index 30d3062..d1dfbfb 100644
@@ -265,7 +265,7 @@ class ThreadedWorker(Thread):
             try:
                 func(self, *args, **kargs)
             except Exception, e:
-                print e
+                print(e)
             finally:
                 self.tasks.task_done()
 
meta/lib/oeqa/runtime/files/test.py +1 -1
index f3a2273..f389225 100644
@@ -3,4 +3,4 @@ import os
 os.system('touch /tmp/testfile.python')
 
 a = 9.01e+21 - 9.01e+21 + 0.01
-print "the value of a is %s" % a
+print("the value of a is %s" % a)
meta/lib/oeqa/runtime/systemd.py +3 -3
index 2b2f10d..a96efa2 100644
@@ -153,7 +153,7 @@ class SystemdJournalTests(SystemdTest):
             if check_match: break
         # put the startup time in the test log
         if check_match:
-            print "%s" % check_match
+            print("%s" % check_match)
         else:
             self.skipTest("Error at obtaining the boot time from journalctl")
         boot_time_sec = 0
@@ -174,5 +174,5 @@ class SystemdJournalTests(SystemdTest):
             self.skipTest("Error when parsing time from boot string")
         #Assert the target boot time against systemd's unit start timeout
         if boot_time_sec > systemd_TimeoutStartSec:
-            print "Target boot time %s exceeds systemd's TimeoutStartSec %s"\
-                    %(boot_time_sec, systemd_TimeoutStartSec)
+            print("Target boot time %s exceeds systemd's TimeoutStartSec %s"\
+                    %(boot_time_sec, systemd_TimeoutStartSec))
meta/lib/oeqa/selftest/base.py +1 -1
index e10455e..b5a52fe 100644
@@ -67,7 +67,7 @@ class oeSelfTest(unittest.TestCase):
                 machine = custommachine
             machine_conf = 'MACHINE ??= "%s"\n' % machine
             self.set_machine_config(machine_conf)
-            print 'MACHINE: %s' % machine
+            print('MACHINE: %s' % machine)
 
         # tests might need their own setup
         # but if they overwrite this one they have to call
scripts/oe-selftest +24 -25

115 lines not on this page · raw message