From 629a433a06b17b8b614a8ec08cf4122365cc1f71 Mon Sep 17 00:00:00 2001 From: raimon Date: Wed, 20 Sep 2023 10:10:09 +0900 Subject: [PATCH 1/2] Terminate --allow-only and --fail-on messages with a newline --- piplicenses.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/piplicenses.py b/piplicenses.py index cc3d7de..14d1dc5 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -322,7 +322,7 @@ def get_python_sys_path(executable: str) -> list[str]: if failed_licenses: sys.stderr.write( "fail-on license {} was found for package " - "{}:{}".format( + "{}:{}\n".format( "; ".join(sorted(failed_licenses)), pkg_info["name"], pkg_info["version"], @@ -337,7 +337,7 @@ def get_python_sys_path(executable: str) -> list[str]: if len(uncommon_licenses) == len(license_names): sys.stderr.write( "license {} not in allow-only licenses was found" - " for package {}:{}".format( + " for package {}:{}\n".format( "; ".join(sorted(uncommon_licenses)), pkg_info["name"], pkg_info["version"], @@ -1079,6 +1079,10 @@ def save_if_needs(output_file: None | str, output_string: str) -> None: try: with open(output_file, "w", encoding="utf-8") as f: f.write(output_string) + if not output_string.endswith("\n"): + # Always end output files with a new line + f.write("\n") + sys.stdout.write("created path: " + output_file + "\n") sys.exit(0) except IOError: From 985fbcaabdd2d9585034dc7a7ef2b773a0f7e2c5 Mon Sep 17 00:00:00 2001 From: raimon Date: Wed, 20 Sep 2023 10:16:26 +0900 Subject: [PATCH 2/2] Bump version to 4.3.3 --- CHANGELOG.md | 5 +++++ piplicenses.py | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c54ac56..1323708 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## CHANGELOG +### 4.3.3 + +* Always terminate `--allow-only` and `--fail-on` messages with a newline +* Always terminate files created with `--output-file` with a newline + ### 4.3.2 * Better handling extracting URLs from `Project-URL` diff --git a/piplicenses.py b/piplicenses.py index 14d1dc5..bcf8644 100644 --- a/piplicenses.py +++ b/piplicenses.py @@ -56,7 +56,7 @@ open = open # allow monkey patching __pkgname__ = "pip-licenses" -__version__ = "4.3.2" +__version__ = "4.3.3" __author__ = "raimon" __license__ = "MIT" __summary__ = (