-
Notifications
You must be signed in to change notification settings - Fork 1
/
noxfile.py
49 lines (40 loc) · 1.08 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
43
44
45
46
47
48
49
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# @Author: José Sánchez-Gallego ([email protected])
# @Date: 2021-06-20
# @Filename: noxfile.py
# @License: BSD 3-clause (http://www.opensource.org/licenses/BSD-3-Clause)
import contextlib
import os
import tempfile
import nox
@contextlib.contextmanager
def cd(path):
CWD = os.getcwd()
os.chdir(path)
try:
yield
finally:
os.chdir(CWD)
@nox.session(name="docs-live", reuse_venv=True)
def docs_live(session):
if session.posargs:
docs_dir = session.posargs[0]
else:
docs_dir = "."
with cd(os.path.join(os.path.dirname(__file__), "docs/sphinx")):
with tempfile.TemporaryDirectory() as destination:
session.run(
"sphinx-autobuild",
# for sphinx-autobuild
"--port=0",
"--open-browser",
# for sphinx
"-b=dirhtml",
"-a",
"--watch=../../src/gort",
docs_dir,
destination,
external=True,
)