Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update ruamel.yaml usage to use supported APIs #5517

Merged
merged 9 commits into from
Oct 25, 2024
6 changes: 4 additions & 2 deletions conda_build/skeletons/pypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
diff core.py core.py
--- core.py
+++ core.py
@@ -166,5 +167,40 @@ def setup (**attrs):
@@ -166,5 +167,42 @@ def setup (**attrs):
\n
+# ====== BEGIN CONDA SKELETON PYPI PATCH ======
+
Expand Down Expand Up @@ -154,7 +154,9 @@
+ data['classifiers'] = kwargs.get('classifiers', None)
+ data['version'] = kwargs.get('version', '??PACKAGE-VERSION-UNKNOWN??')
+ with io.open(os.path.join("{}", "pkginfo.yaml"), 'w', encoding='utf-8') as fn:
+ fn.write(yaml.safe_dump(data, encoding=None))
+ _yaml = yaml.YAML(typ='safe', pure=True)
+ _yaml.encoding = None
+ _yaml.dump(data, fn)
+
+
+# ======= END CONDA SKELETON PYPI PATCH ======
Expand Down
19 changes: 19 additions & 0 deletions news/5517-fix-skeleton-patch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Fixed ruamel.yaml usage to use supported APIs. (#5517)

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
3 changes: 2 additions & 1 deletion tests/test_api_skeleton.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,8 @@ def test_pypi_section_order_preserved(tmp_path: Path):
]

# The loader below preserves the order of entries...
recipe = ruamel.yaml.load("\n".join(lines), Loader=ruamel.yaml.RoundTripLoader)
_yaml = ruamel.yaml.YAML(typ="rt")
recipe = _yaml.load("\n".join(lines))

major_sections = list(recipe.keys())
# Blank fields are omitted when skeletonizing, so prune any missing ones
Expand Down
Loading