Skip to content

Commit

Permalink
Redacts excessive newline (#283)
Browse files Browse the repository at this point in the history
* Redacts trailing line in recipe files to conform with community preferences

* Removes trailing newlines from test files

* Updates hashes used in unit tests
  • Loading branch information
schuylermartin45 authored Jan 6, 2025
1 parent 3e75998 commit 78f6534
Show file tree
Hide file tree
Showing 107 changed files with 118 additions and 114 deletions.
4 changes: 4 additions & 0 deletions conda_recipe_manager/parser/recipe_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,10 @@ def render(self) -> str:
# implied.
RecipeReader._render_tree(self._root, -1, lines)

# If present, redact a trailing blank line as it is preferred by some communities. See Issue #279
if lines and lines[-1] == "":
lines = lines[:-1]

return "\n".join(lines)

@no_type_check
Expand Down
10 changes: 5 additions & 5 deletions tests/parser/test_recipe_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1427,11 +1427,11 @@ def test_search() -> None:
@pytest.mark.parametrize(
"file,expected",
[
("simple-recipe.yaml", "359215c5ac3460d07470f2e3f524ed24154ff2eb7d274feb98149e6949c2ddbe"),
("v1_format/v1_simple-recipe.yaml", "68c0b7fd829c17715b5b9941c882eda3bb70cb1dcef8cc08a55a9ee2b959fb7f"),
("types-toml.yaml", "e117d210da9ea6507fdea856ee96407265aec40cbc58432aa6e1c7e31998a686"),
("v1_format/v1_types-toml.yaml", "3474ed870eea9c8efbd248d24de8bdf54ad8651a7aed06d240f118272d8a3fd1"),
("v1_format/v1_boto.yaml", "b42349254d020ffeda77f3068e8ad8804a92d1c7b89eb0f3d45632b38fc0a3bc"),
("simple-recipe.yaml", "ffb3eba5cdbd950def9301bd7283c68ce002ab6f40de26d4d3c26f93eafd1e26"),
("v1_format/v1_simple-recipe.yaml", "7a4c09fb7c7161a3d11f635e8ed74154dbfb4e28bd83aa7e03ad9d57d22810ab"),
("types-toml.yaml", "d4c2fd9b24793a890e67dc58f5182981b4dd34c50967a8358de10eade8b2e415"),
("v1_format/v1_types-toml.yaml", "9781d24867bc7e3b6e35aca84824c3139f64546b0792af59a361f20dc97a92fe"),
("v1_format/v1_boto.yaml", "9b0f1ca532f4e94346fb69490ee69fb8505e6f76e317466f3b241c334fb4ff5c"),
],
)
def test_calc_sha256(file: str, expected: str) -> None:
Expand Down
2 changes: 1 addition & 1 deletion tests/test_aux_files/boto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ about:
general use.
doc_url: http://docs.pythonboto.org/en/latest/
doc_source_url: https://github.com/boto/boto/blob/develop/docs/source/index.rst
dev_url: https://github.com/boto/boto/
dev_url: https://github.com/boto/boto/
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/boto_build_num_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ about:
general use.
doc_url: http://docs.pythonboto.org/en/latest/
doc_source_url: https://github.com/boto/boto/blob/develop/docs/source/index.rst
dev_url: https://github.com/boto/boto/
dev_url: https://github.com/boto/boto/
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/boto_version_bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ about:
general use.
doc_url: http://docs.pythonboto.org/en/latest/
doc_source_url: https://github.com/boto/boto/blob/develop/docs/source/index.rst
dev_url: https://github.com/boto/boto/
dev_url: https://github.com/boto/boto/
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/build_num_-1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ test_var_usage:
- {{ zz_non_alpha_first }}
- blah
- This {{ name }} is silly
- last
- last
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/build_num_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ test_var_usage:
- {{ zz_non_alpha_first }}
- blah
- This {{ name }} is silly
- last
- last
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/build_num_2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ test_var_usage:
- {{ zz_non_alpha_first }}
- blah
- This {{ name }} is silly
- last
- last
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/build_num_42.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ test_var_usage:
- {{ zz_non_alpha_first }}
- blah
- This {{ name }} is silly
- last
- last
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/build_num_43.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ test_var_usage:
- {{ zz_non_alpha_first }}
- blah
- This {{ name }} is silly
- last
- last
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/build_num_added.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ test_var_usage:
- {{ zz_non_alpha_first }}
- blah
- This {{ name }} is silly
- last
- last
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/curl_build_num_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ extra:
- jakirkham
- ocefpaf
- mingwandroid
- xylar
- xylar
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/curl_version_bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ extra:
- jakirkham
- ocefpaf
- mingwandroid
- xylar
- xylar
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ extra:
- davidbrochart
- dbolduc
- h-vetinari
- xhochy
- xhochy
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ extra:
- davidbrochart
- dbolduc
- h-vetinari
- xhochy
- xhochy
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ about:
summary: (CDT) Shared libraries for GSM speech compressor

extras:
rpm_name: gsm
rpm_name: gsm
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ about:
summary: (CDT) Shared libraries for GSM speech compressor

extras:
rpm_name: gsm
rpm_name: gsm
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ extra:
recipe-maintainers:
- BastianZim
skip-lints:
- python_build_tool_in_run
- python_build_tool_in_run
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ extra:
recipe-maintainers:
- BastianZim
skip-lints:
- python_build_tool_in_run
- python_build_tool_in_run
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ extra:
- ocefpaf
- wesm
- hajapy
- xhochy
- xhochy
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@ extra:
- ocefpaf
- wesm
- hajapy
- xhochy
- xhochy
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/no_build_num.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ test_var_usage:
- {{ zz_non_alpha_first }}
- blah
- This {{ name }} is silly
- last
- last
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ about:
extra:
recipe-maintainers:
- bjodah
- nicoddemus
- nicoddemus
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ about:
extra:
recipe-maintainers:
- bjodah
- nicoddemus
- nicoddemus
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/types-toml_bad_url.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/x264_build_num_1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ extra:
- jakirkham
- 183amir
- carlodri
- sdvillal
- sdvillal
2 changes: 1 addition & 1 deletion tests/test_aux_files/bump_recipe/x264_version_bump.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ extra:
- jakirkham
- 183amir
- carlodri
- sdvillal
- sdvillal
2 changes: 1 addition & 1 deletion tests/test_aux_files/cbc_files/anaconda_cbc_01.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -229,4 +229,4 @@ zip_keys:
- python
- numpy
zstd:
- 1.5.2
- 1.5.2
2 changes: 1 addition & 1 deletion tests/test_aux_files/cctools-ld64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ outputs:
license: Apple Public Source License 2.0
license_family: Other
license_file: cctools/ld64/APPLE_LICENSE
summary: Darwin Mach-O linker
summary: Darwin Mach-O linker
2 changes: 1 addition & 1 deletion tests/test_aux_files/curl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,4 @@ extra:
- jakirkham
- ocefpaf
- mingwandroid
- xylar
- xylar
2 changes: 1 addition & 1 deletion tests/test_aux_files/dot_function_replacement.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ about:
license: MIT
license_file: LICENSE
dev_url: https://github.com/python/typeshed
doc_url: https://pypi.org/project/types-toml/
doc_url: https://pypi.org/project/types-toml/
2 changes: 1 addition & 1 deletion tests/test_aux_files/dynamic-linking.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ about:
license_file: LICENSE
license_family: OTHER
dev_url: https://github.com/python/typeshed
doc_url: https://pypi.org/project/types-toml/
doc_url: https://pypi.org/project/types-toml/
2 changes: 1 addition & 1 deletion tests/test_aux_files/environ_get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

package:
name: abc
version: 0
version: 0
2 changes: 1 addition & 1 deletion tests/test_aux_files/fake_source.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
2 changes: 1 addition & 1 deletion tests/test_aux_files/git-src.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ about:
license: MIT
license_file: LICENSE
dev_url: https://github.com/python/typeshed
doc_url: https://pypi.org/project/types-toml/
doc_url: https://pypi.org/project/types-toml/
2 changes: 1 addition & 1 deletion tests/test_aux_files/google-cloud-cpp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,4 +184,4 @@ extra:
- davidbrochart
- dbolduc
- h-vetinari
- xhochy
- xhochy
2 changes: 1 addition & 1 deletion tests/test_aux_files/gsm-amzn2-aarch64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ about:
summary: (CDT) Shared libraries for GSM speech compressor

extras:
rpm_name: gsm
rpm_name: gsm
2 changes: 1 addition & 1 deletion tests/test_aux_files/h5py.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ extra:
- tacaswell
- ocefpaf
- minrk
- scopatz
- scopatz
2 changes: 1 addition & 1 deletion tests/test_aux_files/hash_type_replacement.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ about:
license: MIT
license_file: LICENSE
dev_url: https://github.com/python/typeshed
doc_url: https://pypi.org/project/types-toml/
doc_url: https://pypi.org/project/types-toml/
2 changes: 1 addition & 1 deletion tests/test_aux_files/huggingface_hub.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ extra:
recipe-maintainers:
- BastianZim
skip-lints:
- python_build_tool_in_run
- python_build_tool_in_run
2 changes: 1 addition & 1 deletion tests/test_aux_files/libprotobuf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ extra:
- ocefpaf
- wesm
- hajapy
- xhochy
- xhochy
2 changes: 1 addition & 1 deletion tests/test_aux_files/multi-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ outputs:
- foo
test:
commands:
- db_archive -m hello
- db_archive -m hello
2 changes: 1 addition & 1 deletion tests/test_aux_files/non_marked_multiline_summary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ about:
license: MIT
license_file: LICENSE
dev_url: https://github.com/python/typeshed
doc_url: https://pypi.org/project/types-toml/
doc_url: https://pypi.org/project/types-toml/
2 changes: 1 addition & 1 deletion tests/test_aux_files/pip_check_only.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ about:
extra:
recipe-maintainers:
- fhoehle
- conda-forge/mypy
- conda-forge/mypy
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ about:
license: MIT
license_file: LICENSE
dev_url: https://github.com/python/typeshed
doc_url: https://pypi.org/project/types-toml/
doc_url: https://pypi.org/project/types-toml/
2 changes: 1 addition & 1 deletion tests/test_aux_files/pre_processor/pp_environ_get.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

package:
name: abc
version: 0
version: 0
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ about:
license: MIT
license_file: LICENSE
dev_url: https://github.com/python/typeshed
doc_url: https://pypi.org/project/types-toml/
doc_url: https://pypi.org/project/types-toml/
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ about:
license: MIT
license_file: LICENSE
dev_url: https://github.com/python/typeshed
doc_url: https://pypi.org/project/types-toml/
doc_url: https://pypi.org/project/types-toml/
Loading

0 comments on commit 78f6534

Please sign in to comment.