summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pym/_emerge/EbuildMetadataPhase.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index 16948df76..e068e8f24 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -10,6 +10,7 @@ from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
+import errno
import fcntl
import io
@@ -75,7 +76,6 @@ class EbuildMetadataPhase(SubProcess):
if fd == sys.stderr.fileno():
sys.stderr.flush()
- fd_pipes_orig = fd_pipes.copy()
self._files = self._files_dict()
files = self._files
@@ -86,8 +86,8 @@ class EbuildMetadataPhase(SubProcess):
fd_pipes[self._metadata_fd] = slave_fd
self._raw_metadata = []
- files.ebuild = os.fdopen(master_fd, 'rb', 0)
- self._reg_id = self.scheduler.register(files.ebuild.fileno(),
+ files.ebuild = master_fd
+ self._reg_id = self.scheduler.register(files.ebuild,
self._registered_events, self._output_handler)
self._registered = True
@@ -112,10 +112,16 @@ class EbuildMetadataPhase(SubProcess):
def _output_handler(self, fd, event):
if event & PollConstants.POLLIN:
- self._raw_metadata.append(self._files.ebuild.read())
- if not self._raw_metadata[-1]:
- self._unregister()
- self.wait()
+ try:
+ self._raw_metadata.append(
+ os.read(self._files.ebuild, self._bufsize))
+ except IOError as e:
+ if e.errno not in (errno.EAGAIN,):
+ raise
+ else:
+ if not self._raw_metadata[-1]:
+ self._unregister()
+ self.wait()
self._unregister_if_appropriate(event)