Skip to content

Commit

Permalink
fixfix
Browse files Browse the repository at this point in the history
  • Loading branch information
hulkoba committed Jun 19, 2024
1 parent 65204e0 commit 56939ed
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions conda_smithy/configure_feedstock.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
from pathlib import Path, PurePath
import requests
from ruamel.yaml import YAML as ruamel_yaml
ruamel_yaml.default_flow_style = False

from collections import OrderedDict

try:
from builtins import ExceptionGroup
Expand Down Expand Up @@ -680,14 +679,6 @@ def _collapse_subpackage_variants(
)


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 _santize_remote_ci_setup(remote_ci_setup):
remote_ci_setup_ = conda_build.utils.ensure_list(remote_ci_setup)
remote_ci_setup = []
Expand Down Expand Up @@ -721,6 +712,10 @@ 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 dump_subspace_config_files(
metas, root_path, platform, arch, upload, forge_config
):
Expand All @@ -743,12 +738,9 @@ def dump_subspace_config_files(
"collapsed subspace config files: {}".format(pprint.pformat(configs))
)

# get rid of the special object notation in the yaml file for objects that we dump
yaml.add_representer(set, yaml.representer.SafeRepresenter.represent_list)
yaml.add_representer(
tuple, yaml.representer.SafeRepresenter.represent_list
)
yaml.add_representer(OrderedDict, _yaml_represent_ordereddict)
ruamel = ruamel_yaml(typ='safe')
ruamel.default_flow_style = False
ruamel.Representer.add_representer(OrderedDict, represent_ordereddict)

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

Expand All @@ -775,9 +767,9 @@ def dump_subspace_config_files(
logger.debug(
"finalized config file: {}".format(pprint.pformat(config))
)

with write_file(out_path) as f:
ruamel_yaml.default_flow_style = False
ruamel_yaml.dump(config, f)
ruamel.dump(config, f)

target_platform = config.get("target_platform", [platform_arch])[0]
result.append(
Expand Down

0 comments on commit 56939ed

Please sign in to comment.