diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-12-25 05:22:05 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-12-25 05:22:05 +0000 |
commit | 589b9c6369fd33ec43c503b930aa92ee2cb1e596 (patch) | |
tree | bb05aa06552170be57f4ba1540efbd7a6b47d469 | |
parent | c9f48656d9215d03417be1af9c52ccffa1bc3210 (diff) | |
download | portage-589b9c6369fd33ec43c503b930aa92ee2cb1e596.tar.gz portage-589b9c6369fd33ec43c503b930aa92ee2cb1e596.tar.bz2 portage-589b9c6369fd33ec43c503b930aa92ee2cb1e596.zip |
Refactor EbuildMetadataPhase._output_handler() and _set_returncode().
svn path=/main/trunk/; revision=12339
-rw-r--r-- | pym/_emerge/__init__.py | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 7306d4215..a80cd21a6 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2904,28 +2904,25 @@ class EbuildMetadataPhase(SubProcess): if event & PollConstants.POLLIN: self._raw_metadata.append(self._files.ebuild.read()) - - if not self._raw_metadata[-1] or event & PollConstants.POLLHUP: - # Split lines here so they can be counted inside _set_returncode(). - self._raw_metadata = "".join(self._raw_metadata).splitlines() - self._unregister() - self.wait() - - if self.returncode == os.EX_OK: - metadata = izip(portage.auxdbkeys, self._raw_metadata) - self.metadata_callback(self.cpv, self.ebuild_path, - self.repo_path, metadata, self.ebuild_mtime) + if not self._raw_metadata[-1]: + self._unregister() + self.wait() self._unregister_if_appropriate(event) return self._registered def _set_returncode(self, wait_retval): SubProcess._set_returncode(self, wait_retval) - if self.returncode == os.EX_OK and \ - len(portage.auxdbkeys) != len(self._raw_metadata): - # Don't trust bash's returncode if the - # number of lines is incorrect. - self.returncode = 1 + if self.returncode == os.EX_OK: + metadata_lines = "".join(self._raw_metadata).splitlines() + if len(portage.auxdbkeys) != len(metadata_lines): + # Don't trust bash's returncode if the + # number of lines is incorrect. + self.returncode = 1 + else: + metadata = izip(portage.auxdbkeys, metadata_lines) + self.metadata_callback(self.cpv, self.ebuild_path, + self.repo_path, metadata, self.ebuild_mtime) class EbuildProcess(SpawnProcess): |