Skip to content

Commit

Permalink
build: do not print non-error messages to stderr
Browse files Browse the repository at this point in the history
  • Loading branch information
umarcor committed Mar 21, 2023
1 parent f8ebf92 commit 1752e6a
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/towncrier/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,12 @@ def __main(
The main entry point.
"""
base_directory, config = load_config_from_options(directory, config_file)
to_err = draft

click.echo("Loading template...", err=to_err)
click.echo("Loading template...")
with open(config.template, "rb") as tmpl:
template = tmpl.read().decode("utf8")

click.echo("Finding news fragments...", err=to_err)
click.echo("Finding news fragments...")

if config.directory is not None:
fragment_base_directory = os.path.abspath(config.directory)
Expand All @@ -177,7 +176,7 @@ def __main(
config.orphan_prefix,
)

click.echo("Rendering news fragments...", err=to_err)
click.echo("Rendering news fragments...")
fragments = split_fragments(
fragment_contents, config.types, all_bullets=config.all_bullets
)
Expand Down Expand Up @@ -250,13 +249,12 @@ def __main(
if draft and filename is None:
click.echo(
"Print draft to stdout only -- nothing has been written.\n"
"What is seen below is what would be written.\n",
err=to_err,
"What is seen below is what would be written.\n"
)
click.echo(content)
return

click.echo("Writing to newsfile...", err=to_err)
click.echo("Writing to newsfile...")

if filename is None:
filename = config.filename
Expand All @@ -282,18 +280,18 @@ def __main(
)

if not draft:
click.echo("Staging newsfile...", err=to_err)
click.echo("Staging newsfile...")
_git.stage_newsfile(base_directory, filename)

if should_remove_fragment_files(
fragment_filenames,
answer_yes,
answer_keep,
):
click.echo("Removing news fragments...", err=to_err)
click.echo("Removing news fragments...")
_git.remove_files(fragment_filenames)

click.echo("Done!", err=to_err)
click.echo("Done!")


def should_remove_fragment_files(
Expand Down

0 comments on commit 1752e6a

Please sign in to comment.