summaryrefslogtreecommitdiff
path: root/lib/spack/llnl/util/tty/color.py
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2019-06-07 18:57:26 +0200
committerTodd Gamblin <tgamblin@llnl.gov>2019-06-07 09:57:26 -0700
commit6d56d4545472ddff1cdc0e8fd49d8260428a141e (patch)
tree957a23e8bc69f7ea6d51edddedde308bcf1afa38 /lib/spack/llnl/util/tty/color.py
parent9c1c50fb7632d179cae32b28e4561c9e041b97f0 (diff)
downloadspack-6d56d4545472ddff1cdc0e8fd49d8260428a141e.tar.gz
spack-6d56d4545472ddff1cdc0e8fd49d8260428a141e.tar.bz2
spack-6d56d4545472ddff1cdc0e8fd49d8260428a141e.tar.xz
spack-6d56d4545472ddff1cdc0e8fd49d8260428a141e.zip
Compiler search uses a pool of workers (#10190)
- spack.compilers.find_compilers now uses a multiprocess.pool.ThreadPool to execute system commands for the detection of compiler versions. - A few memoized functions have been introduced to avoid poking the filesystem multiple times for the same results. - Performance is much improved, and Spack no longer fork-bombs the system when doing a `compiler find`
Diffstat (limited to 'lib/spack/llnl/util/tty/color.py')
-rw-r--r--lib/spack/llnl/util/tty/color.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/spack/llnl/util/tty/color.py b/lib/spack/llnl/util/tty/color.py
index fd982b54af..6789ecbdb3 100644
--- a/lib/spack/llnl/util/tty/color.py
+++ b/lib/spack/llnl/util/tty/color.py
@@ -59,10 +59,14 @@ The console can be reset later to plain text with '@.'.
To output an @, use '@@'. To output a } inside braces, use '}}'.
"""
+from __future__ import unicode_literals
import re
import sys
+
from contextlib import contextmanager
+import six
+
class ColorParseError(Exception):
"""Raised when a color format fails to parse."""
@@ -244,7 +248,7 @@ def cescape(string):
Returns:
(str): the string with color codes escaped
"""
- string = str(string)
+ string = six.text_type(string)
string = string.replace('@', '@@')
string = string.replace('}', '}}')
return string