summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorAndreas Finkler <3929834+DudeNr33@users.noreply.github.com>2022-10-30 16:00:38 +0100
committerGitHub <noreply@github.com>2022-10-30 16:00:38 +0100
commit5c7f98099c719038fa07eba61f288c0a7cc48f92 (patch)
tree7c96c79c81e1bd0ffd5bea7e64b39bfd2c7d5390 /script
parentdfd0e5aefe2e90b64099b97fe8dc78f813d5b149 (diff)
downloadpylint-git-5c7f98099c719038fa07eba61f288c0a7cc48f92.tar.gz
`check_newsfragments`: Improve output on Windows machines (#7612)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'script')
-rw-r--r--script/check_newsfragments.py12
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())