diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-11 22:54:22 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-13 13:41:32 +0100 |
commit | fce8da957fd2bbf1c3b02dfe34bc18a0bce37d65 (patch) | |
tree | 8e269c8576aac8fe7cd284ae3241271340c3d733 | |
parent | 9a309684cfff5e1de3dbcc9690fc73d344e63ecd (diff) | |
download | poky-fce8da957fd2bbf1c3b02dfe34bc18a0bce37d65.tar.gz |
bitbake: daemonize/prserv/tests/fetch: Convert file() -> open()
Use python3 compatible functions.
(Bitbake rev: e6a0296ba29c3fbc8417d1df7a01d50562668a41)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/daemonize.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 2 | ||||
-rw-r--r-- | bitbake/lib/prserv/serv.py | 10 |
3 files changed, 8 insertions, 8 deletions
diff --git a/bitbake/lib/bb/daemonize.py b/bitbake/lib/bb/daemonize.py index 346a618582..ab4a954622 100644 --- a/bitbake/lib/bb/daemonize.py +++ b/bitbake/lib/bb/daemonize.py | |||
@@ -178,8 +178,8 @@ def createDaemon(function, logfile): | |||
178 | # os.dup2(0, 2) # standard error (2) | 178 | # os.dup2(0, 2) # standard error (2) |
179 | 179 | ||
180 | 180 | ||
181 | si = file('/dev/null', 'r') | 181 | si = open('/dev/null', 'r') |
182 | so = file(logfile, 'w') | 182 | so = open(logfile, 'w') |
183 | se = so | 183 | se = so |
184 | 184 | ||
185 | 185 | ||
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 4ba688bfea..cba783f5ab 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -450,7 +450,7 @@ class MirrorUriTest(FetcherTest): | |||
450 | class FetcherLocalTest(FetcherTest): | 450 | class FetcherLocalTest(FetcherTest): |
451 | def setUp(self): | 451 | def setUp(self): |
452 | def touch(fn): | 452 | def touch(fn): |
453 | with file(fn, 'a'): | 453 | with open(fn, 'a'): |
454 | os.utime(fn, None) | 454 | os.utime(fn, None) |
455 | 455 | ||
456 | super(FetcherLocalTest, self).setUp() | 456 | super(FetcherLocalTest, self).setUp() |
diff --git a/bitbake/lib/prserv/serv.py b/bitbake/lib/prserv/serv.py index affccd9b3b..8cec9f8870 100644 --- a/bitbake/lib/prserv/serv.py +++ b/bitbake/lib/prserv/serv.py | |||
@@ -242,8 +242,8 @@ class PRServer(SimpleXMLRPCServer): | |||
242 | 242 | ||
243 | sys.stdout.flush() | 243 | sys.stdout.flush() |
244 | sys.stderr.flush() | 244 | sys.stderr.flush() |
245 | si = file('/dev/null', 'r') | 245 | si = open('/dev/null', 'r') |
246 | so = file(self.logfile, 'a+') | 246 | so = open(self.logfile, 'a+') |
247 | se = so | 247 | se = so |
248 | os.dup2(si.fileno(),sys.stdin.fileno()) | 248 | os.dup2(si.fileno(),sys.stdin.fileno()) |
249 | os.dup2(so.fileno(),sys.stdout.fileno()) | 249 | os.dup2(so.fileno(),sys.stdout.fileno()) |
@@ -263,7 +263,7 @@ class PRServer(SimpleXMLRPCServer): | |||
263 | 263 | ||
264 | # write pidfile | 264 | # write pidfile |
265 | pid = str(os.getpid()) | 265 | pid = str(os.getpid()) |
266 | pf = file(self.pidfile, 'w') | 266 | pf = open(self.pidfile, 'w') |
267 | pf.write("%s\n" % pid) | 267 | pf.write("%s\n" % pid) |
268 | pf.close() | 268 | pf.close() |
269 | 269 | ||
@@ -323,7 +323,7 @@ def start_daemon(dbfile, host, port, logfile): | |||
323 | ip = socket.gethostbyname(host) | 323 | ip = socket.gethostbyname(host) |
324 | pidfile = PIDPREFIX % (ip, port) | 324 | pidfile = PIDPREFIX % (ip, port) |
325 | try: | 325 | try: |
326 | pf = file(pidfile,'r') | 326 | pf = open(pidfile,'r') |
327 | pid = int(pf.readline().strip()) | 327 | pid = int(pf.readline().strip()) |
328 | pf.close() | 328 | pf.close() |
329 | except IOError: | 329 | except IOError: |
@@ -350,7 +350,7 @@ def stop_daemon(host, port): | |||
350 | ip = socket.gethostbyname(host) | 350 | ip = socket.gethostbyname(host) |
351 | pidfile = PIDPREFIX % (ip, port) | 351 | pidfile = PIDPREFIX % (ip, port) |
352 | try: | 352 | try: |
353 | pf = file(pidfile,'r') | 353 | pf = open(pidfile,'r') |
354 | pid = int(pf.readline().strip()) | 354 | pid = int(pf.readline().strip()) |
355 | pf.close() | 355 | pf.close() |
356 | except IOError: | 356 | except IOError: |