summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-01-19 09:57:02 -0800
committerZac Medico <zmedico@gentoo.org>2011-01-19 11:11:55 -0800
commit0622571a89f0286074efd975060bb928cd1eeb8a (patch)
treea82f92df2cd96f589c0c6808415a02bfa1cd82f6
parentdoebuid: clean up AA handling (diff)
downloadportage-0622571a89f0286074efd975060bb928cd1eeb8a.tar.gz
portage-0622571a89f0286074efd975060bb928cd1eeb8a.tar.bz2
portage-0622571a89f0286074efd975060bb928cd1eeb8a.zip
BinpkgFetcher: ust pty like EbuildFetcher
-rw-r--r--pym/_emerge/BinpkgFetcher.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/pym/_emerge/BinpkgFetcher.py b/pym/_emerge/BinpkgFetcher.py
index 9876cf444..942bcdf70 100644
--- a/pym/_emerge/BinpkgFetcher.py
+++ b/pym/_emerge/BinpkgFetcher.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2010 Gentoo Foundation
+# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.AsynchronousLock import AsynchronousLock
@@ -11,6 +11,7 @@ import stat
import sys
import portage
from portage import os
+from portage.util._pty import _create_pty_or_pipe
if sys.hexversion >= 0x3000000:
long = int
@@ -101,6 +102,20 @@ class BinpkgFetcher(SpawnProcess):
self.env = fetch_env
SpawnProcess._start(self)
+ def _pipe(self, fd_pipes):
+ """When appropriate, use a pty so that fetcher progress bars,
+ like wget has, will work properly."""
+ if self.background or not sys.stdout.isatty():
+ # When the output only goes to a log file,
+ # there's no point in creating a pty.
+ return os.pipe()
+ stdout_pipe = None
+ if not self.background:
+ stdout_pipe = fd_pipes.get(1)
+ got_pty, master_fd, slave_fd = \
+ _create_pty_or_pipe(copy_term_size=stdout_pipe)
+ return (master_fd, slave_fd)
+
def _set_returncode(self, wait_retval):
SpawnProcess._set_returncode(self, wait_retval)
if not self.pretend and self.returncode == os.EX_OK: