From 9848191c1c1c7086b75b2dda4ccab4bea002cc3b Mon Sep 17 00:00:00 2001 From: Bill Little Date: Mon, 26 Aug 2024 16:24:09 +0100 Subject: [PATCH] fix for towncrier>=24.7.0 --- setup.cfg | 2 +- sphinx_changelog/towncrier.py | 16 +--------------- 2 files changed, 2 insertions(+), 16 deletions(-) diff --git a/setup.cfg b/setup.cfg index c800f7e..95f8904 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,7 +15,7 @@ python_requires = >=3.8 setup_requires = setuptools_scm install_requires = sphinx - towncrier==23.11.0 + towncrier==24.8.0 [options.extras_require] test = diff --git a/sphinx_changelog/towncrier.py b/sphinx_changelog/towncrier.py index 6ad4b92..6ce2210 100644 --- a/sphinx_changelog/towncrier.py +++ b/sphinx_changelog/towncrier.py @@ -41,9 +41,6 @@ def generate_changelog_for_docs(directory, skip_if_empty=True, underline=1): directory = os.path.abspath(directory) base_directory, config = load_config_from_options(directory, None) - curdir = os.getcwd() - os.chdir(base_directory) - print("Loading template...") if isinstance(config.template, tuple): template = ( @@ -57,17 +54,8 @@ def generate_changelog_for_docs(directory, skip_if_empty=True, underline=1): definitions = config.types - if config.directory: - base_directory = os.path.abspath(config.directory) - fragment_directory = None - else: - base_directory = os.path.abspath( - os.path.join(directory, config.package_dir, config.package) - ) - fragment_directory = "newsfragments" - fragments, fragment_filenames = find_fragments( - base_directory, config.sections, fragment_directory, definitions + base_directory, config, strict=False ) # Empty fragments now are an OrderedDict([('', {})]) @@ -114,8 +102,6 @@ def generate_changelog_for_docs(directory, skip_if_empty=True, underline=1): render_title=render_title, ) - os.chdir(curdir) - if not render_title: # Prepend the custom title format top_line = config.title_format.format( name=project_name, version=project_version, project_date=project_date