adding towncrier wrapper script so 'tox -e docs' works natively on windows (#7266)

* enable tox -e docs natively on windows using a wrapper

* rename the towncrier script; run the towncrier command in a safer manner

* use subprocess.call; call exit() around main on towncrier wrapper

* change to sys.exit() instead of builtin exit()
This commit is contained in:
Simon K 2020-05-31 16:11:11 +01:00 committed by GitHub
parent c16ede5ce6
commit 9da1d0687e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -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())

View File

@ -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