diff --git a/scripts/towncrier-draft-to-file.py b/scripts/towncrier-draft-to-file.py new file mode 100644 index 000000000..81507b40b --- /dev/null +++ b/scripts/towncrier-draft-to-file.py @@ -0,0 +1,15 @@ +import sys +from subprocess import call + + +def main(): + """ + Platform agnostic wrapper script for towncrier. + Fixes the issue (#7251) where windows users are unable to natively run tox -e docs to build pytest docs. + """ + with open("doc/en/_changelog_towncrier_draft.rst", "w") as draft_file: + return call(("towncrier", "--draft"), stdout=draft_file) + + +if __name__ == "__main__": + sys.exit(main()) diff --git a/tox.ini b/tox.ini index f363f5701..8e1a51ca7 100644 --- a/tox.ini +++ b/tox.ini @@ -80,9 +80,8 @@ usedevelop = True deps = -r{toxinidir}/doc/en/requirements.txt towncrier -whitelist_externals = sh commands = - sh -c 'towncrier --draft > doc/en/_changelog_towncrier_draft.rst' + python scripts/towncrier-draft-to-file.py # the '-t changelog_towncrier_draft' tags makes sphinx include the draft # changelog in the docs; this does not happen on ReadTheDocs because it uses # the standard sphinx command so the 'changelog_towncrier_draft' is never set there