Skip to content

Commit

Permalink
Reflect expectation that a non-existent directory is honored and trea…
Browse files Browse the repository at this point in the history
…ted like an empty directory. Closes twisted#538.
  • Loading branch information
jaraco committed Oct 24, 2023
1 parent c0034ea commit 0277388
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 3 additions & 2 deletions docs/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ The following options can be passed to all of the commands that explained below:
Build the combined news file from news fragments.
``build`` is also assumed if no command is passed.

If there are no news fragments (including an empty fragments directory), a
notice of "no significant changes" will be added to the news file.
If there are no news fragments (including an empty fragments directory or a
non-existent directory), a notice of "no significant changes" will be added to
the news file.

By default, the processed news fragments are removed using ``git``, which will
also remove the fragments directory if now empty.
Expand Down
10 changes: 2 additions & 8 deletions src/towncrier/_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@

import os
import textwrap
import traceback

from collections import defaultdict
from typing import Any, DefaultDict, Iterable, Iterator, Mapping, Sequence

from jinja2 import Template

from ._settings import ConfigError


def strip_if_integer_string(s: str) -> str:
try:
Expand Down Expand Up @@ -102,11 +99,8 @@ def find_fragments(

try:
files = os.listdir(section_dir)
except FileNotFoundError as e:
message = "Failed to list the news fragment files.\n{}".format(
"".join(traceback.format_exception_only(type(e), e)),
)
raise ConfigError(message)
except FileNotFoundError:
files = []

file_content = {}

Expand Down

0 comments on commit 0277388

Please sign in to comment.