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:
parent
c16ede5ce6
commit
9da1d0687e
|
@ -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())
|
3
tox.ini
3
tox.ini
|
@ -80,9 +80,8 @@ usedevelop = True
|
||||||
deps =
|
deps =
|
||||||
-r{toxinidir}/doc/en/requirements.txt
|
-r{toxinidir}/doc/en/requirements.txt
|
||||||
towncrier
|
towncrier
|
||||||
whitelist_externals = sh
|
|
||||||
commands =
|
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
|
# the '-t changelog_towncrier_draft' tags makes sphinx include the draft
|
||||||
# changelog in the docs; this does not happen on ReadTheDocs because it uses
|
# 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
|
# the standard sphinx command so the 'changelog_towncrier_draft' is never set there
|
||||||
|
|
Loading…
Reference in New Issue