From d49c98188a68d4aad0410ac1d0df759117773937 Mon Sep 17 00:00:00 2001 From: Todd Gamblin Date: Sun, 22 Feb 2015 21:17:18 -0800 Subject: Add an override to colify so we can set terminal dimensions. --- lib/spack/docs/conf.py | 4 +--- lib/spack/llnl/util/tty/colify.py | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index b4d49c594d..7b350f73b5 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -48,9 +48,7 @@ os.environ['PATH'] += os.pathsep + '$SPACK_ROOT/bin' # Set an environment variable so that colify will print output like it would to # a terminal. -os.environ['COLIFY_TTY'] = 'true' -os.environ['COLUMNS'] = '80' -os.environ['LINES'] = '25' +os.environ['COLIFY_SIZE'] = '25x80' # Enable todo items todo_include_todos = True diff --git a/lib/spack/llnl/util/tty/colify.py b/lib/spack/llnl/util/tty/colify.py index 6b2909990c..66c52c3968 100644 --- a/lib/spack/llnl/util/tty/colify.py +++ b/lib/spack/llnl/util/tty/colify.py @@ -169,6 +169,15 @@ def colify(elts, **options): if not elts: return (0, ()) + # environment size is of the form "x" + env_size = os.environ.get('COLIFY_SIZE') + if env_size: + try: + r, c = env_size.split('x') + console_rows, console_cols = int(r), int(c) + tty = True + except: pass + # Use only one column if not a tty. if not tty: if tty is False or not output.isatty(): -- cgit v1.2.3-60-g2f50