Skip to content

Commit

Permalink
fix: update ruamel.yaml usage to use supported APIs (#5517)
Browse files Browse the repository at this point in the history
* fix: update pypi skeleton patch to use latest ruamel.yaml syntax

* Create 5517-fix-skeleton-patch.rst

* fix: encoding keyword no longer working

* fix: try this patch

* fix: use new syntax for ruamel.yaml

* doc: update changelog

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix: syntax error for yaml parser

* style: add back newline

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
beckermr and pre-commit-ci[bot] authored Oct 25, 2024
1 parent ebaf9ed commit 810be76
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
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

0 comments on commit 810be76

Please sign in to comment.