From 0df0405f8f963f38a9e048dcfdd200a389ce32a3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 12 Oct 2008 00:46:59 +0000 Subject: Buge #241100 - Make EbuildFetcher use a pty when appropriate, so that fetcher progress bars, like wget has, will work properly. svn path=/main/trunk/; revision=11680 --- pym/_emerge/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pym/_emerge/__init__.py') diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 7e29d9eea..a392c2d71 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -2279,6 +2279,18 @@ class EbuildFetcher(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.prefetch or 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 = fd_pipes.get(1) + got_pty, master_fd, slave_fd = \ + portage._create_pty_or_pipe(copy_term_size=stdout_pipe) + return (master_fd, slave_fd) + def _clean_builddir(self): """Uses shutil.rmtree() rather than spawning a 'clean' phase. Disabled by keepwork or keeptemp in FEATURES.""" -- cgit v1.2.3-1-g7c22