Buge #241100 - Make EbuildFetcher use a pty when appropriate, so that fetcher
authorZac Medico <zmedico@gentoo.org>
Sun, 12 Oct 2008 00:46:59 +0000 (00:46 -0000)
committerZac Medico <zmedico@gentoo.org>
Sun, 12 Oct 2008 00:46:59 +0000 (00:46 -0000)
progress bars, like wget has, will work properly.

svn path=/main/trunk/; revision=11680

pym/_emerge/__init__.py

index 7e29d9eea49e0d8d92a4d37d5454f144d03d5882..a392c2d71e648d2a4642a8169a42cb2e5bb10356 100644 (file)
@@ -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."""