summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-08-22 14:12:31 -0700
committerZac Medico <zmedico@gentoo.org>2012-08-22 14:12:31 -0700
commit5335ccb6558f22ddc926714dcba4443cc7333b6a (patch)
tree5f359ee1aa6b68ead47d1a8a3c73017ebee51e35
parentmake.conf.5: s/Hash functions/Hash function/ (diff)
downloadportage-2.2.0_alpha122.tar.gz
portage-2.2.0_alpha122.tar.bz2
portage-2.2.0_alpha122.zip
Optimize sys.std* flush code.v2.2.0_alpha122
-rw-r--r--pym/_emerge/EbuildMetadataPhase.py5
-rw-r--r--pym/_emerge/SpawnProcess.py5
2 files changed, 6 insertions, 4 deletions
diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py
index d49c51f79..9ab03e24e 100644
--- a/pym/_emerge/EbuildMetadataPhase.py
+++ b/pym/_emerge/EbuildMetadataPhase.py
@@ -78,11 +78,12 @@ class EbuildMetadataPhase(SubProcess):
fd_pipes.setdefault(2, sys.__stderr__.fileno())
# flush any pending output
+ stdout_filenos = (sys.__stdout__.fileno(), sys.__stderr__.fileno())
for fd in fd_pipes.values():
- if fd == sys.__stdout__.fileno():
+ if fd in stdout_filenos:
sys.__stdout__.flush()
- if fd == sys.__stderr__.fileno():
sys.__stderr__.flush()
+ break
self._files = self._files_dict()
files = self._files
diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py
index dfcf088bc..c7863c1ec 100644
--- a/pym/_emerge/SpawnProcess.py
+++ b/pym/_emerge/SpawnProcess.py
@@ -67,11 +67,12 @@ class SpawnProcess(SubProcess):
fd_pipes.setdefault(2, sys.__stderr__.fileno())
# flush any pending output
+ stdout_filenos = (sys.__stdout__.fileno(), sys.__stderr__.fileno())
for fd in fd_pipes.values():
- if fd == sys.__stdout__.fileno():
+ if fd in stdout_filenos:
sys.__stdout__.flush()
- if fd == sys.__stderr__.fileno():
sys.__stderr__.flush()
+ break
if logfile is not None: