From 81fc303212b8379219cf5d463c8717359b972dba Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 18 Sep 2010 04:58:40 -0700 Subject: Use blocking IO in ebuild-ipc.py and EbuildIpcDaemon._send_reply(), in hopes that it will be more portable (see bug #337465). --- bin/ebuild-ipc.py | 18 +----------------- pym/_emerge/EbuildIpcDaemon.py | 7 +------ 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py index 2d524a752..7637fb5d5 100755 --- a/bin/ebuild-ipc.py +++ b/bin/ebuild-ipc.py @@ -9,7 +9,6 @@ import array import logging import os import pickle -import select import signal import sys import time @@ -91,9 +90,6 @@ class EbuildIpc(object): # File streams are in unbuffered mode since we do atomic # read and write of whole pickles. - input_fd = os.open(self.ipc_out_fifo, - os.O_RDONLY|os.O_NONBLOCK) - input_file = os.fdopen(input_fd, 'rb', 0) output_file = None while True: @@ -124,19 +120,7 @@ class EbuildIpc(object): self._no_daemon_msg() return 2 - start_time = time.time() - while True: - events = select.select([input_file], [], [], - self._COMMUNICATE_RETRY_TIMEOUT_SECONDS) - if events[0]: - break - else: - if self._daemon_is_alive(): - self._timeout_retry_msg(start_time, - portage.localization._('during select')) - else: - self._no_daemon_msg() - return 2 + input_file = open(self.ipc_out_fifo, 'rb', 0) start_time = time.time() while True: diff --git a/pym/_emerge/EbuildIpcDaemon.py b/pym/_emerge/EbuildIpcDaemon.py index 66d868ba2..73a088c5e 100644 --- a/pym/_emerge/EbuildIpcDaemon.py +++ b/pym/_emerge/EbuildIpcDaemon.py @@ -3,9 +3,7 @@ import errno import pickle -from portage import os from _emerge.FifoIpcDaemon import FifoIpcDaemon -from _emerge.PollConstants import PollConstants class EbuildIpcDaemon(FifoIpcDaemon): """ @@ -67,15 +65,12 @@ class EbuildIpcDaemon(FifoIpcDaemon): reply_hook() def _send_reply(self, reply): - output_fd = os.open(self.output_fifo, os.O_WRONLY|os.O_NONBLOCK) - # File streams are in unbuffered mode since we do atomic # read and write of whole pickles. - output_file = os.fdopen(output_fd, 'wb', 0) + output_file = open(self.output_fifo, 'wb', 0) # Write the whole pickle in a single atomic write() call, # since the reader is in non-blocking mode and we want # it to get the whole pickle at once. output_file.write(pickle.dumps(reply)) - output_file.flush() output_file.close() -- cgit v1.2.3-1-g7c22