diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-16 08:29:52 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-16 09:31:23 +0100 |
commit | 9094ea9fdd1f23cbc9f7a9d0d95fb330c5ea8906 (patch) | |
tree | ac254d468956292d45e9ab7ead3fbe16f1558f62 /meta/classes | |
parent | ca2edae7c3585204a11f6d9d69351d37880bf761 (diff) | |
download | poky-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>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/grub-efi.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/oelint.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/syslinux.bbclass | 2 | ||||
-rw-r--r-- | meta/classes/tinderclient.bbclass | 26 |
4 files changed, 16 insertions, 16 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() { | |||
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 1b051ca22e..c4febc2cfa 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 4fcb0c5e72..d4ae699375 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 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): | |||
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 |