summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-11-05 11:53:20 -0700
committerZac Medico <zmedico@gentoo.org>2011-11-05 11:53:20 -0700
commit7c5e61b3f442b8ca2e75a08bf34eb65eec285b93 (patch)
tree5b765b21d9b3d8fd4250e6a04bf02edee2996d71 /pym
parentab484dc9a2612aa6709fad3ff926c8589a706637 (diff)
downloadportage-7c5e61b3f442b8ca2e75a08bf34eb65eec285b93.tar.gz
portage-7c5e61b3f442b8ca2e75a08bf34eb65eec285b93.tar.bz2
portage-7c5e61b3f442b8ca2e75a08bf34eb65eec285b93.zip
Enable colors during the depend phase.
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/package/ebuild/doebuild.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index ccea574c5..cb7da78c7 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -283,6 +283,19 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
(c, style_to_ansi_code(c)))
mysettings["PORTAGE_COLORMAP"] = "\n".join(mycolors)
+ if "COLUMNS" not in mysettings:
+ # Set COLUMNS, in order to prevent unnecessary stty calls
+ # inside the set_colors function of isolated-functions.sh.
+ # We cache the result in os.environ, in order to avoid
+ # multiple stty calls in cases when get_term_size() falls
+ # back to stty due to a missing or broken curses module.
+ columns = os.environ.get("COLUMNS")
+ if columns is None:
+ rows, columns = portage.output.get_term_size()
+ columns = str(columns)
+ os.environ["COLUMNS"] = columns
+ mysettings["COLUMNS"] = columns
+
# All EAPI dependent code comes last, so that essential variables
# like PORTAGE_BUILDDIR are still initialized even in cases when
# UnsupportedAPIException needs to be raised, which can be useful