summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-16 07:29:52 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-16 08:31:23 (GMT)
commit9094ea9fdd1f23cbc9f7a9d0d95fb330c5ea8906 (patch)
treeac254d468956292d45e9ab7ead3fbe16f1558f62
parentca2edae7c3585204a11f6d9d69351d37880bf761 (diff)
downloadpoky-9094ea9fdd1f23cbc9f7a9d0d95fb330c5ea8906.tar.gz
classes/oeqa: Update for print statements and file() -> open() for python3uninative-1.0
Found some more syntax cleanups needed for python3. (From OE-Core rev: 1181d86e8707c5b8e8d43d5e785d7d9cf01fa491) 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 4ce3d28..d0ae6c9 100644
--- a/meta/classes/grub-efi.bbclass
+++ b/meta/classes/grub-efi.bbclass
@@ -91,7 +91,7 @@ python build_efi_cfg() {
91 raise bb.build.FuncFailed('Unable to read GRUB_CFG') 91 raise bb.build.FuncFailed('Unable to read GRUB_CFG')
92 92
93 try: 93 try:
94 cfgfile = file(cfile, 'w') 94 cfgfile = open(cfile, 'w')
95 except OSError: 95 except OSError:
96 raise bb.build.funcFailed('Unable to open %s' % (cfile)) 96 raise bb.build.funcFailed('Unable to open %s' % (cfile))
97 97
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() {
45 45
46 def findKey(path, key): 46 def findKey(path, key):
47 ret = True 47 ret = True
48 f = file('%s' % path, mode = 'r') 48 f = open('%s' % path, mode = 'r')
49 line = f.readline() 49 line = f.readline()
50 while line: 50 while line:
51 if line.find(key) != -1: 51 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 () {
102 raise bb.build.FuncFailed('Unable to read SYSLINUX_CFG') 102 raise bb.build.FuncFailed('Unable to read SYSLINUX_CFG')
103 103
104 try: 104 try:
105 cfgfile = file(cfile, 'w') 105 cfgfile = open(cfile, 'w')
106 except OSError: 106 except OSError:
107 raise bb.build.funcFailed('Unable to open %s' % (cfile)) 107 raise bb.build.funcFailed('Unable to open %s' % (cfile))
108 108
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):
10 h.endheaders() 10 h.endheaders()
11 h.send(body) 11 h.send(body)
12 errcode, errmsg, headers = h.getreply() 12 errcode, errmsg, headers = h.getreply()
13 #print errcode, errmsg, headers 13 #print(errcode, errmsg, headers)
14 return (errcode,errmsg, headers, h.file) 14 return (errcode,errmsg, headers, h.file)
15 except: 15 except:
16 print "Error sending the report!" 16 print("Error sending the report!")
17 # try again 17 # try again
18 pass 18 pass
19 19
@@ -82,7 +82,7 @@ def tinder_format_http_post(d,status,log):
82 # we only need on build_status.pl but sending it 82 # we only need on build_status.pl but sending it
83 # always does not hurt 83 # always does not hurt
84 try: 84 try:
85 f = file(d.getVar('TMPDIR',True)+'/tinder-machine.id', 'r') 85 f = open(d.getVar('TMPDIR',True)+'/tinder-machine.id', 'r')
86 id = f.read() 86 id = f.read()
87 variables['machine_id'] = id 87 variables['machine_id'] = id
88 except: 88 except:
@@ -111,11 +111,11 @@ def tinder_build_start(d):
111 111
112 selector = url + "/xml/build_start.pl" 112 selector = url + "/xml/build_start.pl"
113 113
114 #print "selector %s and url %s" % (selector, url) 114 #print("selector %s and url %s" % (selector, url))
115 115
116 # now post it 116 # now post it
117 errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) 117 errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
118 #print errcode, errmsg, headers 118 #print(errcode, errmsg, headers)
119 report = h_file.read() 119 report = h_file.read()
120 120
121 # now let us find the machine id that was assigned to us 121 # now let us find the machine id that was assigned to us
@@ -127,7 +127,7 @@ def tinder_build_start(d):
127 127
128 # now we will need to save the machine number 128 # now we will need to save the machine number
129 # we will override any previous numbers 129 # we will override any previous numbers
130 f = file(d.getVar('TMPDIR', True)+"/tinder-machine.id", 'w') 130 f = open(d.getVar('TMPDIR', True)+"/tinder-machine.id", 'w')
131 f.write(report) 131 f.write(report)
132 132
133 133
@@ -147,8 +147,8 @@ def tinder_send_http(d, status, _log):
147 while len(new_log) > 0: 147 while len(new_log) > 0:
148 content_type, body = tinder_format_http_post(d,status,new_log[0:18000]) 148 content_type, body = tinder_format_http_post(d,status,new_log[0:18000])
149 errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body) 149 errcode, errmsg, headers, h_file = tinder_http_post(server,selector,content_type, body)
150 #print errcode, errmsg, headers 150 #print(errcode, errmsg, headers)
151 #print h.file.read() 151 #print(h.file.read())
152 new_log = new_log[18000:] 152 new_log = new_log[18000:]
153 153
154 154
@@ -278,7 +278,7 @@ def tinder_do_tinder_report(event):
278 278
279 try: 279 try:
280 # truncate the tinder log file 280 # truncate the tinder log file
281 f = file(event.data.getVar('TINDER_LOG', True), 'w') 281 f = open(event.data.getVar('TINDER_LOG', True), 'w')
282 f.write("") 282 f.write("")
283 f.close() 283 f.close()
284 except: 284 except:
@@ -287,7 +287,7 @@ def tinder_do_tinder_report(event):
287 try: 287 try:
288 # write a status to the file. This is needed for the -k option 288 # write a status to the file. This is needed for the -k option
289 # of BitBake 289 # of BitBake
290 g = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w') 290 g = open(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
291 g.write("") 291 g.write("")
292 g.close() 292 g.close()
293 except IOError: 293 except IOError:
@@ -319,14 +319,14 @@ def tinder_do_tinder_report(event):
319 log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % event.data.getVar('PF', True) 319 log += "<--- TINDERBOX Package %s failed (FAILURE)\n" % event.data.getVar('PF', True)
320 status = 200 320 status = 200
321 # remember the failure for the -k case 321 # remember the failure for the -k case
322 h = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w') 322 h = open(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
323 h.write("200") 323 h.write("200")
324 elif name == "BuildCompleted": 324 elif name == "BuildCompleted":
325 log += "Build Completed\n" 325 log += "Build Completed\n"
326 status = 100 326 status = 100
327 # Check if we have a old status... 327 # Check if we have a old status...
328 try: 328 try:
329 h = file(event.data.getVar('TMPDIR',True)+'/tinder-status', 'r') 329 h = open(event.data.getVar('TMPDIR',True)+'/tinder-status', 'r')
330 status = int(h.read()) 330 status = int(h.read())
331 except: 331 except:
332 pass 332 pass
@@ -342,7 +342,7 @@ def tinder_do_tinder_report(event):
342 log += "Error:Was Runtime: %d\n" % event.isRuntime() 342 log += "Error:Was Runtime: %d\n" % event.isRuntime()
343 status = 200 343 status = 200
344 # remember the failure for the -k case 344 # remember the failure for the -k case
345 h = file(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w') 345 h = open(event.data.getVar('TMPDIR', True)+"/tinder-status", 'w')
346 h.write("200") 346 h.write("200")
347 347
348 # now post the log 348 # 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:
354 if p not in parents: 354 if p not in parents:
355 parents.append(p) 355 parents.append(p)
356 newparents = next 356 newparents = next
357 #print "Children matching %s:" % str(parents) 357 #print("Children matching %s:" % str(parents))
358 for p in parents: 358 for p in parents:
359 # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx" 359 # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx"
360 # Also, old versions of ldd (2.11) run "LD_XXXX qemu-system-xxxx" 360 # 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):
160 if p not in parents: 160 if p not in parents:
161 parents.append(p) 161 parents.append(p)
162 newparents = next 162 newparents = next
163 #print "Children matching %s:" % str(parents) 163 #print("Children matching %s:" % str(parents))
164 for p in parents: 164 for p in parents:
165 # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx" 165 # Need to be careful here since runqemu-internal runs "ldd qemu-system-xxxx"
166 # Also, old versions of ldd (2.11) run "LD_XXXX qemu-system-xxxx" 166 # 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:
17 pass 17 pass
18 def plain(self, msg): 18 def plain(self, msg):
19 if msg: 19 if msg:
20 print msg 20 print(msg)
21 def warn(self, msg): 21 def warn(self, msg):
22 if msg: 22 if msg:
23 print "WARNING: " + msg 23 print("WARNING: " + msg)
24 def fatal(self, msg): 24 def fatal(self, msg):
25 if msg: 25 if msg:
26 print "FATAL:" + msg 26 print("FATAL:" + msg)
27 sys.exit(1) 27 sys.exit(1)
28 bb = my_log() 28 bb = my_log()
29 29