summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2015-02-22 21:17:18 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2015-02-23 01:23:30 -0800
commitd49c98188a68d4aad0410ac1d0df759117773937 (patch)
tree975ca208848cc60f7f6b2048c54faef5a0bf1086 /lib
parent065e5ccd1a09cdb24db78c871cd512b4d305e0e6 (diff)
downloadspack-d49c98188a68d4aad0410ac1d0df759117773937.tar.gz
spack-d49c98188a68d4aad0410ac1d0df759117773937.tar.bz2
spack-d49c98188a68d4aad0410ac1d0df759117773937.tar.xz
spack-d49c98188a68d4aad0410ac1d0df759117773937.zip
Add an override to colify so we can set terminal dimensions.
Diffstat (limited to 'lib')
-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():