summaryrefslogtreecommitdiff
path: root/lib/spack/llnl/util/tty/color.py
diff options
context:
space:
mode:
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