forked from pypa/packaging.python.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnox.py
45 lines (33 loc) · 1.12 KB
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# 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 os
import nox
@nox.session
def build(session):
session.interpreter = 'python3.6'
session.install('-r', 'requirements.txt')
# Treat warnings as errors.
session.env['SPHINXOPTS'] = '-W'
session.run('make', 'clean', 'html')
@nox.session
def preview(session):
session.reuse_existing_virtualenv = True
build(session)
session.chdir('build/html')
session.run('python', '-m', 'http.server')
def linkmonitor(session, command):
if not os.path.exists(os.path.join('build', 'html')):
session.error('HTML output not available, run nox -s build first.')
session.interpreter = 'python3.6'
session.install('-r', 'scripts/linkmonitor/requirements.txt')
session.run(
'python', 'scripts/linkmonitor/linkmonitor.py', command,
success_codes=[0, 1])
@nox.session
def checklinks(session):
linkmonitor(session, 'check')
@nox.session
def updatelinks(session):
linkmonitor(session, 'update')