[gnome-continuous-yocto/gnomeostree-3.28-rocko: 318/8267] classes/oeqa: Update for print statements and file() -> open() for python3



commit 9094ea9fdd1f23cbc9f7a9d0d95fb330c5ea8906
Author: Richard Purdie <richard purdie linuxfoundation org>
Date:   Mon May 16 08:29:52 2016 +0100

    classes/oeqa: Update for print statements and file() -> open() for python3
    
    Found some more syntax cleanups needed for python3.
    
    (From OE-Core rev: 1181d86e8707c5b8e8d43d5e785d7d9cf01fa491)
    
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 meta/classes/grub-efi.bbclass         |    2 +-
 meta/classes/oelint.bbclass           |    2 +-
 meta/classes/syslinux.bbclass         |    2 +-
 meta/classes/tinderclient.bbclass     |   26 +++++++++++++-------------
 meta/lib/oeqa/utils/qemurunner.py     |    2 +-
 meta/lib/oeqa/utils/qemutinyrunner.py |    2 +-
 meta/lib/oeqa/utils/testexport.py     |    6 +++---
 7 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 4ce3d28..d0ae6c9 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -91,7 +91,7 @@ python build_efi_cfg() {
         raise bb.build.FuncFailed('Unable to read GRUB_CFG')
 
     try:
-         cfgfile = file(cfile, 'w')
+         cfgfile = open(cfile, 'w')
     except OSError:
         raise bb.build.funcFailed('Unable to open %s' % (cfile))
 
diff --git a/meta/classes/oelint.bbclass b/meta/classes/oelint.bbclass
index 1b051ca..c4febc2 100644
--- a/meta/classes/oelint.bbclass
+++ b/meta/classes/oelint.bbclass
@@ -45,7 +45,7 @@ python do_lint() {
 
     def findKey(path, key):
         ret = True
-        f = file('%s' % path, mode = 'r')
+        f = open('%s' % path, mode = 'r')
         line = f.readline()
         while line:
             if line.find(key) != -1:
diff --git a/meta/classes/syslinux.bbclass b/meta/classes/syslinux.bbclass
index 4fcb0c5..d4ae699 100644
--- a/meta/classes/syslinux.bbclass
+++ b/meta/classes/syslinux.bbclass
@@ -102,7 +102,7 @@ python build_syslinux_cfg () {
         raise bb.build.FuncFailed('Unable to read SYSLINUX_CFG')
 
     try:
-        cfgfile = file(cfile, 'w')
+        cfgfile = open(cfile, 'w')
     except OSError:
         raise bb.build.funcFailed('Unable to open %s' % (cfile))
 
diff --git a/meta/classes/tinderclient.bbclass b/meta/classes/tinderclient.bbclass
index 2bc75fc..917b74d 100644
--- a/meta/classes/tinderclient.bbclass
+++ b/meta/classes/tinderclient.bbclass
@@ -10,10 +10,10 @@ def tinder_http_post(server, selector, content_type, body):
             h.endheaders()
             h.send(body)
             errcode, errmsg, headers = h.getreply()
-            #print errcode, errmsg, headers
+            #print(errcode, errmsg, headers)
             return (errcode,errmsg, headers, h.file)
         except:
-            print "Error sending the report!"
+            print("Error sending the report!")
             # try again
             pass
 
@@ -82,7 +82,7 @@ def tinder_format_http_post(d,status,log):
     # we only need on build_status.pl but sending it
     # always does not hurt
     try:
-        f = file(d.getVar('TMPDIR',True)+'/tinder-machine.id', 'r')
+        f = open(d.getVar('TMPDIR',True)+'/tinder-machine.id', 'r')
         id = f.read()
         variables['machine_id'] = id
     except:
@@ -111,11 +111,11 @@ def tinder_build_start(d):
 
     selector = url + "/xml/build_start.pl"
 
-    #print "selector %s and url %s" % (selector, url)
+    #print("selector %s and url %s" % (selector, url))
 
     # now post it
     errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
-    #print errcode, errmsg, headers
+    #print(errcode, errmsg, headers)
     report = h_file.read()
 
     # now let us find the machine id that was assigned to us
@@ -127,7 +127,7 @@ def tinder_build_start(d):
 
     # now we will need to save the machine number
     # we will override any previous numbers
-    f = file(d.getVar('TMPDIR', True)+"/tinder-machine.id", 'w')
+    f = open(d.getVar('TMPDIR', True)+"/tinder-machine.id", 'w')
     f.write(report)
 
 
@@ -147,8 +147,8 @@ def tinder_send_http(d, status, _log):
     while len(new_log) > 0:
         content_type, body = tinder_format_http_post(d,status,new_log[0:18000])
         errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
-        #print errcode, errmsg, headers
-        #print h.file.read()
+        #print(errcode, errmsg, headers)
+        #print(h.file.read())
         new_log = new_log[18000:]
 
 
@@ -278,7 +278,7 @@ def tinder_do_tinder_report(event):
 
         try:
             # truncate the tinder log file
-            f = file(event.data.getVar('TINDER_LOG', True), 'w')
+            f = open(event.data.getVar('TINDER_LOG', True), 'w')
             f.write("")
             f.close()
         except:
@@ -287,7 +287,7 @@ def tinder_do_tinder_report(event):
         try:
             # write a status to the file. This is needed for the -k option
             # of BitBake
-            g = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
+            g = open(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
             g.write("")
             g.close()
         except IOError:
@@ -319,14 +319,14 @@ def tinder_do_tinder_report(event):
         log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % event.data.getVar('PF', True)
         status = 200
         # remember the failure for the -k case
-        h = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
+        h = open(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
         h.write("200")
     elif name == "BuildCompleted":
         log += "Build Completed\n"
         status = 100
         # Check if we have a old status...
         try:
-            h = file(event.data.getVar('TMPDIR',True)+'/tinder-status', 'r')
+            h = open(event.data.getVar('TMPDIR',True)+'/tinder-status', 'r')
             status = int(h.read())
         except:
             pass
@@ -342,7 +342,7 @@ def tinder_do_tinder_report(event):
         log += "Error:Was Runtime: %d\n" % event.isRuntime()
         status = 200
         # remember the failure for the -k case
-        h = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
+        h = open(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
         h.write("200")
 
     # now post the log
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 784cf96..4bede34 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -354,7 +354,7 @@ class QemuRunner:
                 if p not in parents:
                     parents.append(p)
                     newparents = next
-        #print "Children matching %s:" % str(parents)
+        #print("Children matching %s:" % str(parents))
         for p in parents:
             # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx"
             # Also, old versions of ldd (2.11) run "LD_XXXX qemu-system-xxxx"
diff --git a/meta/lib/oeqa/utils/qemutinyrunner.py b/meta/lib/oeqa/utils/qemutinyrunner.py
index 4f95101..e3d8c66 100644
--- a/meta/lib/oeqa/utils/qemutinyrunner.py
+++ b/meta/lib/oeqa/utils/qemutinyrunner.py
@@ -160,7 +160,7 @@ class QemuTinyRunner(QemuRunner):
                 if p not in parents:
                     parents.append(p)
                     newparents = next
-        #print "Children matching %s:" % str(parents)
+        #print("Children matching %s:" % str(parents))
         for p in parents:
             # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx"
             # Also, old versions of ldd (2.11) run "LD_XXXX qemu-system-xxxx"
diff --git a/meta/lib/oeqa/utils/testexport.py b/meta/lib/oeqa/utils/testexport.py
index 243463b..4fbf4bd 100644
--- a/meta/lib/oeqa/utils/testexport.py
+++ b/meta/lib/oeqa/utils/testexport.py
@@ -17,13 +17,13 @@ except ImportError:
             pass
         def plain(self, msg):
             if msg:
-                print msg
+                print(msg)
         def warn(self, msg):
             if msg:
-                print "WARNING: " + msg
+                print("WARNING: " + msg)
         def fatal(self, msg):
             if msg:
-                print "FATAL:" + msg
+                print("FATAL:" + msg)
                 sys.exit(1)
     bb = my_log()    
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]