Skip to content

Commit 78fbdc3

Browse files
authored
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 <[email protected]>
1 parent 3b16838 commit 78fbdc3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/conf.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@
5959

6060
def generate_draft_news():
6161
root = Path(__file__).parents[1]
62-
exe = Path(sys.executable)
63-
towncrier = exe.with_name("towncrier{}".format(exe.suffix))
64-
new = subprocess.check_output([str(towncrier), "--draft", "--version", "NEXT"], cwd=root, universal_newlines=True)
62+
new = subprocess.check_output(
63+
[sys.executable, "-m", "towncrier", "--draft", "--version", "NEXT"], cwd=root, universal_newlines=True,
64+
)
6565
(root / "docs" / "_draft.rst").write_text("" if "No significant changes" in new else new)
6666

6767

0 commit comments

Comments
 (0)