Skip to content

Commit

Permalink
Call towncrier via python instead of doing poor path reconstruction (#…
Browse files Browse the repository at this point in the history
…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]>
  • Loading branch information
mgorny authored Jun 6, 2020
1 parent 3b16838 commit 78fbdc3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down

0 comments on commit 78fbdc3

Please sign in to comment.