aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-16 08:29:52 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-16 09:30:28 +0100
commit1181d86e8707c5b8e8d43d5e785d7d9cf01fa491 (patch)
tree0e003b3b781ceee01fb16654ba0f78f3807bda55
parent0c89a8a276b67a9292ee3100003c789126bd9ea9 (diff)
downloadopenembedded-core-contrib-1181d86e8707c5b8e8d43d5e785d7d9cf01fa491.tar.gz
classes/oeqa: Update for print statements and file() -> open() for python3
Found some more syntax cleanups needed for python3. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/grub-efi.bbclass2
-rw-r--r--meta/classes/oelint.bbclass2
-rw-r--r--meta/classes/syslinux.bbclass2
-rw-r--r--meta/classes/tinderclient.bbclass26
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py2
-rw-r--r--meta/lib/oeqa/utils/qemutinyrunner.py2
-rw-r--r--meta/lib/oeqa/utils/testexport.py6
7 files changed, 21 insertions, 21 deletions
diff --git a/meta/classes/grub-efi.bbclass b/meta/classes/grub-efi.bbclass
index 4ce3d2844a..d0ae6c90f8 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 1b051ca22e..c4febc2cfa 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 4fcb0c5e72..d4ae699375 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 2bc75fc65e..917b74d887 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 784cf964f5..4bede3421c 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 4f95101f30..e3d8c669e0 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 243463bc15..4fbf4bdcb3 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()