summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/docs/conf.py4
-rw-r--r--lib/spack/llnl/util/tty/colify.py9
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 "<rows>x<cols>"
+ 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():