summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/environment.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/spack/spack/environment.py b/lib/spack/spack/environment.py
index a37cad8633..979e14e8c9 100644
--- a/lib/spack/spack/environment.py
+++ b/lib/spack/spack/environment.py
@@ -9,6 +9,7 @@ import sys
import shutil
import copy
import six
+import ruamel.yaml as yaml
from ordereddict_backport import OrderedDict
@@ -478,9 +479,12 @@ class ViewDescriptor(object):
def to_dict(self):
ret = syaml.syaml_dict([('root', self.root)])
if self.projections:
- projections_dict = syaml.syaml_dict(
- sorted(self.projections.items()))
- ret['projections'] = projections_dict
+ # projections guaranteed to be ordered dict if true-ish
+ # for python2.6, may be syaml or ruamel.yaml implementation
+ # so we have to check for both
+ types = (OrderedDict, syaml.syaml_dict, yaml.comments.CommentedMap)
+ assert isinstance(self.projections, types)
+ ret['projections'] = self.projections
if self.select:
ret['select'] = self.select
if self.exclude: