forked from pypa/packaging.python.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nox.py
30 lines (23 loc) · 791 Bytes
/
nox.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
# Copyright 2017, PyPA
# The Python Packaging User Guide is licensed under a Creative Commons
# Attribution-ShareAlike license:
# http://creativecommons.org/licenses/by-sa/3.0.
import shutil
import nox
@nox.session
def build(session, autobuild=False):
session.interpreter = 'python3.6'
session.install('-r', 'requirements.txt')
# Treat warnings as errors.
session.env['SPHINXOPTS'] = '-W'
session.run(shutil.rmtree, 'build', ignore_errors=True)
if autobuild:
command = 'sphinx-autobuild'
else:
command = 'sphinx-build'
session.run(command, '-W', '-b', 'html', 'source', 'build')
@nox.session
def preview(session):
session.reuse_existing_virtualenv = True
session.install("sphinx-autobuild")
build(session, autobuild=True)