Skip to content

Commit

Permalink
orderedDict
Browse files Browse the repository at this point in the history
  • Loading branch information
hulkoba committed Jun 19, 2024
1 parent dbf28f0 commit ea29add
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions conda_smithy/configure_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from pathlib import Path, PurePath
import requests
from ruamel.yaml import YAML as ruamel_yaml
from collections import OrderedDict

try:
from builtins import ExceptionGroup
Expand Down Expand Up @@ -712,8 +711,14 @@ def finalize_config(config, platform, arch, forge_config):
return config


def represent_ordereddict(dumper, data):
return dumper.represent_mapping(u'tag:yaml.org,2002:map', data)
# def represent_ordereddict(dumper, data):
# return dumper.represent_mapping(u'tag:yaml.org,2002:map', data)
def _yaml_represent_ordereddict(yaml_representer, data):
# represent_dict processes dict-likes with a .sort() method or plain iterables of key-value
# pairs. Only for the latter it never sorts and retains the order of the OrderedDict.
return yaml.representer.SafeRepresenter.represent_dict(
yaml_representer, data.items()
)


def dump_subspace_config_files(
Expand All @@ -740,7 +745,8 @@ def dump_subspace_config_files(

ruamel = ruamel_yaml(typ='safe')
ruamel.default_flow_style = False
ruamel.Representer.add_representer(OrderedDict, represent_ordereddict)
# ruamel.Representer.add_representer(OrderedDict, represent_ordereddict)
ruamel.Representer.add_representer(OrderedDict, _yaml_represent_ordereddict)

platform_arch = "{}-{}".format(platform, arch)

Expand Down

0 comments on commit ea29add

Please sign in to comment.