-
Notifications
You must be signed in to change notification settings - Fork 16
/
noxfile.py
42 lines (31 loc) · 1.04 KB
/
noxfile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""Nox sessions."""
from pathlib import Path
import shutil
import nox
from nox.sessions import Session
nox.options.sessions = (
"linkcheck",
)
@nox.session
def docs(session: Session) -> None:
"""Build the documentation."""
args = session.posargs or ["-W", "-n", "docs", "docs/_build"]
if session.interactive and not session.posargs:
args = ["-a", "--watch=docs/_static", "--open-browser", *args]
builddir = Path("docs", "_build")
if builddir.exists():
shutil.rmtree(builddir)
session.install("-r", "docs/requirements.txt")
if session.interactive:
session.run("sphinx-autobuild", *args)
else:
session.run("sphinx-build", *args)
@nox.session
def linkcheck(session: Session) -> None:
"""Build the documentation."""
args = session.posargs or ["-W", "-b", "linkcheck", "docs", "docs/_build"]
builddir = Path("docs", "_build")
if builddir.exists():
shutil.rmtree(builddir)
session.install("-r", "docs/requirements.txt")
session.run("sphinx-build", *args)