diff options
Diffstat (limited to 'script')
-rw-r--r-- | script/check_newsfragments.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/script/check_newsfragments.py b/script/check_newsfragments.py index 577b4ba88..3327d2d5d 100644 --- a/script/check_newsfragments.py +++ b/script/check_newsfragments.py @@ -51,14 +51,14 @@ def check_file(file: Path, verbose: bool) -> bool: if match: issue = match.group("issue") if file.stem != issue: - print( + echo( f"{file} must be named '{issue}.<fragmenttype>', after the issue it references." ) return False if verbose: - print(f"Checked '{file}': LGTM 🤖👍") + echo(f"Checked '{file}': LGTM 🤖👍") return True - print( + echo( f"""\ {file}: does not respect the standard format 🤖👎 @@ -82,5 +82,11 @@ Refs #1234 return False +def echo(msg: str) -> None: + # To support non-UTF-8 environments like Windows, we need + # to explicitly encode the message instead of using plain print() + sys.stdout.buffer.write(f"{msg}\n".encode()) + + if __name__ == "__main__": sys.exit(main()) |