From 78fbdc35688ad12542e4fb7e97a84c2d8f272e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Sat, 6 Jun 2020 13:10:26 +0200 Subject: [PATCH] Call towncrier via python instead of doing poor path reconstruction (#1848) Trying to append an executable suffix to towncrier does not work on Linux, as it can create absurd names like `towncrier.7` (`.7` coming from `python3.7`). Let's instead call it via `python -m towncrier`. This should avoid relying on correct `PATH` (as I presume the original code is meant to), while working correctly on all systems and not requiring Python and towncrier to reside in the same directory. Fixes #1847 Signed-off-by: Bernat Gabor --- docs/conf.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 5605cfb55..3c61e8d5a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -59,9 +59,9 @@ def generate_draft_news(): root = Path(__file__).parents[1] - exe = Path(sys.executable) - towncrier = exe.with_name("towncrier{}".format(exe.suffix)) - new = subprocess.check_output([str(towncrier), "--draft", "--version", "NEXT"], cwd=root, universal_newlines=True) + new = subprocess.check_output( + [sys.executable, "-m", "towncrier", "--draft", "--version", "NEXT"], cwd=root, universal_newlines=True, + ) (root / "docs" / "_draft.rst").write_text("" if "No significant changes" in new else new)