summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/util/spack_yaml.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/spack/spack/util/spack_yaml.py b/lib/spack/spack/util/spack_yaml.py
index ee4b37388c..a1966664d9 100644
--- a/lib/spack/spack/util/spack_yaml.py
+++ b/lib/spack/spack/util/spack_yaml.py
@@ -275,6 +275,8 @@ class LineAnnotationDumper(OrderedLineDumper):
def __init__(self, *args, **kwargs):
super(LineAnnotationDumper, self).__init__(*args, **kwargs)
del _annotations[:]
+ self.colors = 'KgrbmcyGRBMCY'
+ self.filename_colors = {}
def process_scalar(self):
super(LineAnnotationDumper, self).process_scalar()
@@ -301,7 +303,15 @@ class LineAnnotationDumper(OrderedLineDumper):
# append annotations at the end of each line
if self.saved:
mark = self.saved._start_mark
- ann = '@K{%s}' % mark.name
+
+ color = self.filename_colors.get(mark.name)
+ if not color:
+ ncolors = len(self.colors)
+ color = self.colors[len(self.filename_colors) % ncolors]
+ self.filename_colors[mark.name] = color
+
+ fmt = '@%s{%%s}' % color
+ ann = fmt % mark.name
if mark.line is not None:
ann += ':@c{%s}' % (mark.line + 1)
_annotations.append(colorize(ann))