mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
bitbake: daemonize/prserv/tests/fetch: Convert file() -> open()
Use python3 compatible functions. (Bitbake rev: e6a0296ba29c3fbc8417d1df7a01d50562668a41) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
9a309684cf
commit
fce8da957f
|
@ -178,8 +178,8 @@ def createDaemon(function, logfile):
|
||||||
# os.dup2(0, 2) # standard error (2)
|
# os.dup2(0, 2) # standard error (2)
|
||||||
|
|
||||||
|
|
||||||
si = file('/dev/null', 'r')
|
si = open('/dev/null', 'r')
|
||||||
so = file(logfile, 'w')
|
so = open(logfile, 'w')
|
||||||
se = so
|
se = so
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -450,7 +450,7 @@ class MirrorUriTest(FetcherTest):
|
||||||
class FetcherLocalTest(FetcherTest):
|
class FetcherLocalTest(FetcherTest):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
def touch(fn):
|
def touch(fn):
|
||||||
with file(fn, 'a'):
|
with open(fn, 'a'):
|
||||||
os.utime(fn, None)
|
os.utime(fn, None)
|
||||||
|
|
||||||
super(FetcherLocalTest, self).setUp()
|
super(FetcherLocalTest, self).setUp()
|
||||||
|
|
|
@ -242,8 +242,8 @@ class PRServer(SimpleXMLRPCServer):
|
||||||
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
si = file('/dev/null', 'r')
|
si = open('/dev/null', 'r')
|
||||||
so = file(self.logfile, 'a+')
|
so = open(self.logfile, 'a+')
|
||||||
se = so
|
se = so
|
||||||
os.dup2(si.fileno(),sys.stdin.fileno())
|
os.dup2(si.fileno(),sys.stdin.fileno())
|
||||||
os.dup2(so.fileno(),sys.stdout.fileno())
|
os.dup2(so.fileno(),sys.stdout.fileno())
|
||||||
|
@ -263,7 +263,7 @@ class PRServer(SimpleXMLRPCServer):
|
||||||
|
|
||||||
# write pidfile
|
# write pidfile
|
||||||
pid = str(os.getpid())
|
pid = str(os.getpid())
|
||||||
pf = file(self.pidfile, 'w')
|
pf = open(self.pidfile, 'w')
|
||||||
pf.write("%s\n" % pid)
|
pf.write("%s\n" % pid)
|
||||||
pf.close()
|
pf.close()
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ def start_daemon(dbfile, host, port, logfile):
|
||||||
ip = socket.gethostbyname(host)
|
ip = socket.gethostbyname(host)
|
||||||
pidfile = PIDPREFIX % (ip, port)
|
pidfile = PIDPREFIX % (ip, port)
|
||||||
try:
|
try:
|
||||||
pf = file(pidfile,'r')
|
pf = open(pidfile,'r')
|
||||||
pid = int(pf.readline().strip())
|
pid = int(pf.readline().strip())
|
||||||
pf.close()
|
pf.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
|
@ -350,7 +350,7 @@ def stop_daemon(host, port):
|
||||||
ip = socket.gethostbyname(host)
|
ip = socket.gethostbyname(host)
|
||||||
pidfile = PIDPREFIX % (ip, port)
|
pidfile = PIDPREFIX % (ip, port)
|
||||||
try:
|
try:
|
||||||
pf = file(pidfile,'r')
|
pf = open(pidfile,'r')
|
||||||
pid = int(pf.readline().strip())
|
pid = int(pf.readline().strip())
|
||||||
pf.close()
|
pf.close()
|
||||||
except IOError:
|
except IOError:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user