mirror of
https://git.yoctoproject.org/poky
synced 2026-06-03 13:49:49 +00:00
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>
This commit is contained in:
@@ -91,7 +91,7 @@ python build_efi_cfg() {
|
|||||||
raise bb.build.FuncFailed('Unable to read GRUB_CFG')
|
raise bb.build.FuncFailed('Unable to read GRUB_CFG')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cfgfile = file(cfile, 'w')
|
cfgfile = open(cfile, 'w')
|
||||||
except OSError:
|
except OSError:
|
||||||
raise bb.build.funcFailed('Unable to open %s' % (cfile))
|
raise bb.build.funcFailed('Unable to open %s' % (cfile))
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ python do_lint() {
|
|||||||
|
|
||||||
def findKey(path, key):
|
def findKey(path, key):
|
||||||
ret = True
|
ret = True
|
||||||
f = file('%s' % path, mode = 'r')
|
f = open('%s' % path, mode = 'r')
|
||||||
line = f.readline()
|
line = f.readline()
|
||||||
while line:
|
while line:
|
||||||
if line.find(key) != -1:
|
if line.find(key) != -1:
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ python build_syslinux_cfg () {
|
|||||||
raise bb.build.FuncFailed('Unable to read SYSLINUX_CFG')
|
raise bb.build.FuncFailed('Unable to read SYSLINUX_CFG')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cfgfile = file(cfile, 'w')
|
cfgfile = open(cfile, 'w')
|
||||||
except OSError:
|
except OSError:
|
||||||
raise bb.build.funcFailed('Unable to open %s' % (cfile))
|
raise bb.build.funcFailed('Unable to open %s' % (cfile))
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,10 @@ def tinder_http_post(server, selector, content_type, body):
|
|||||||
h.endheaders()
|
h.endheaders()
|
||||||
h.send(body)
|
h.send(body)
|
||||||
errcode, errmsg, headers = h.getreply()
|
errcode, errmsg, headers = h.getreply()
|
||||||
#print errcode, errmsg, headers
|
#print(errcode, errmsg, headers)
|
||||||
return (errcode,errmsg, headers, h.file)
|
return (errcode,errmsg, headers, h.file)
|
||||||
except:
|
except:
|
||||||
print "Error sending the report!"
|
print("Error sending the report!")
|
||||||
# try again
|
# try again
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -82,7 +82,7 @@ def tinder_format_http_post(d,status,log):
|
|||||||
# we only need on build_status.pl but sending it
|
# we only need on build_status.pl but sending it
|
||||||
# always does not hurt
|
# always does not hurt
|
||||||
try:
|
try:
|
||||||
f = file(d.getVar('TMPDIR',True)+'/tinder-machine.id', 'r')
|
f = open(d.getVar('TMPDIR',True)+'/tinder-machine.id', 'r')
|
||||||
id = f.read()
|
id = f.read()
|
||||||
variables['machine_id'] = id
|
variables['machine_id'] = id
|
||||||
except:
|
except:
|
||||||
@@ -111,11 +111,11 @@ def tinder_build_start(d):
|
|||||||
|
|
||||||
selector = url + "/xml/build_start.pl"
|
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
|
# now post it
|
||||||
errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
|
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()
|
report = h_file.read()
|
||||||
|
|
||||||
# now let us find the machine id that was assigned to us
|
# 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
|
# now we will need to save the machine number
|
||||||
# we will override any previous numbers
|
# 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)
|
f.write(report)
|
||||||
|
|
||||||
|
|
||||||
@@ -147,8 +147,8 @@ def tinder_send_http(d, status, _log):
|
|||||||
while len(new_log) > 0:
|
while len(new_log) > 0:
|
||||||
content_type, body = tinder_format_http_post(d,status,new_log[0:18000])
|
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)
|
errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
|
||||||
#print errcode, errmsg, headers
|
#print(errcode, errmsg, headers)
|
||||||
#print h.file.read()
|
#print(h.file.read())
|
||||||
new_log = new_log[18000:]
|
new_log = new_log[18000:]
|
||||||
|
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ def tinder_do_tinder_report(event):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# truncate the tinder log file
|
# 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.write("")
|
||||||
f.close()
|
f.close()
|
||||||
except:
|
except:
|
||||||
@@ -287,7 +287,7 @@ def tinder_do_tinder_report(event):
|
|||||||
try:
|
try:
|
||||||
# write a status to the file. This is needed for the -k option
|
# write a status to the file. This is needed for the -k option
|
||||||
# of BitBake
|
# 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.write("")
|
||||||
g.close()
|
g.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
@@ -319,14 +319,14 @@ def tinder_do_tinder_report(event):
|
|||||||
log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % event.data.getVar('PF', True)
|
log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % event.data.getVar('PF', True)
|
||||||
status = 200
|
status = 200
|
||||||
# remember the failure for the -k case
|
# 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")
|
h.write("200")
|
||||||
elif name == "BuildCompleted":
|
elif name == "BuildCompleted":
|
||||||
log += "Build Completed\n"
|
log += "Build Completed\n"
|
||||||
status = 100
|
status = 100
|
||||||
# Check if we have a old status...
|
# Check if we have a old status...
|
||||||
try:
|
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())
|
status = int(h.read())
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
@@ -342,7 +342,7 @@ def tinder_do_tinder_report(event):
|
|||||||
log += "Error:Was Runtime: %d\n" % event.isRuntime()
|
log += "Error:Was Runtime: %d\n" % event.isRuntime()
|
||||||
status = 200
|
status = 200
|
||||||
# remember the failure for the -k case
|
# 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")
|
h.write("200")
|
||||||
|
|
||||||
# now post the log
|
# now post the log
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ class QemuRunner:
|
|||||||
if p not in parents:
|
if p not in parents:
|
||||||
parents.append(p)
|
parents.append(p)
|
||||||
newparents = next
|
newparents = next
|
||||||
#print "Children matching %s:" % str(parents)
|
#print("Children matching %s:" % str(parents))
|
||||||
for p in parents:
|
for p in parents:
|
||||||
# Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx"
|
# 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"
|
# Also, old versions of ldd (2.11) run "LD_XXXX qemu-system-xxxx"
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ class QemuTinyRunner(QemuRunner):
|
|||||||
if p not in parents:
|
if p not in parents:
|
||||||
parents.append(p)
|
parents.append(p)
|
||||||
newparents = next
|
newparents = next
|
||||||
#print "Children matching %s:" % str(parents)
|
#print("Children matching %s:" % str(parents))
|
||||||
for p in parents:
|
for p in parents:
|
||||||
# Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx"
|
# 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"
|
# Also, old versions of ldd (2.11) run "LD_XXXX qemu-system-xxxx"
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
def plain(self, msg):
|
def plain(self, msg):
|
||||||
if msg:
|
if msg:
|
||||||
print msg
|
print(msg)
|
||||||
def warn(self, msg):
|
def warn(self, msg):
|
||||||
if msg:
|
if msg:
|
||||||
print "WARNING: " + msg
|
print("WARNING: " + msg)
|
||||||
def fatal(self, msg):
|
def fatal(self, msg):
|
||||||
if msg:
|
if msg:
|
||||||
print "FATAL:" + msg
|
print("FATAL:" + msg)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
bb = my_log()
|
bb = my_log()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user