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 for towncrier>=24.7.0 #27

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
16 changes: 1 addition & 15 deletions sphinx_changelog/towncrier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = (
Expand All @@ -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
Copy link
Contributor Author

@bjlittle bjlittle Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've set strict=False here to ensure the same sphinx-changelog behaviour.

If we opt to set this to True then users may have to explicitly include their template file to the configured ignore files.

)

# Empty fragments now are an OrderedDict([('', {})])
Expand Down Expand Up @@ -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
Expand Down