Skip to content

Commit

Permalink
Make the project compatible with Towncrier >= 24.7
Browse files Browse the repository at this point in the history
Towncrier 24.7 changed the way that its `find_fragments()` function
works to accept a `Config` dataclass instead of specific components of
the config.

Co-Authored-By: Ben Rowland <[email protected]>

Closes sphinx-contrib#94
Resolves sphinx-contrib#92
  • Loading branch information
webknjaz committed Dec 23, 2024
1 parent d0b42d8 commit 53c29c8
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions src/sphinxcontrib/towncrier/_fragment_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,24 @@ def lookup_towncrier_fragments( # noqa: WPS210
else:
fragment_directory = None

_fragments, fragment_filenames = find_fragments(
str(fragment_base_directory),
towncrier_config.sections,
fragment_directory,
towncrier_config.types,
)
try:
# Towncrier < 24.7.0rc1
# pylint: disable-next=no-value-for-parameter,unexpected-keyword-arg
_fragments, fragment_filenames = find_fragments(
base_directory=str(fragment_base_directory),
sections=towncrier_config.sections,
fragment_directory=fragment_directory,
frag_type_names=towncrier_config.types,
orphan_prefix='+',
)
except TypeError:
# Towncrier >= 24.7.0rc1
_fragments, fragment_filenames = find_fragments( # noqa: WPS121
base_directory=str(fragment_base_directory),
config=towncrier_config,
strict=False,
)

return {Path(fname[0]) for fname in fragment_filenames}

return set(fragment_filenames)

0 comments on commit 53c29c8

Please sign in to comment.