-
Notifications
You must be signed in to change notification settings - Fork 2
/
tasks.py
63 lines (55 loc) · 1.73 KB
/
tasks.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
from pathlib import Path
import http.server
import socketserver
from invoke import run, task
ROOT = Path(__file__).parent
@task
def pdf(ctx):
"""Builds the pdf version in the print folder"""
cwd = os.getcwd()
os.chdir(ROOT)
run('mkdir -p print && cd doc && xelatex -output-directory=../print blueprint.tex')
run('cd print && bibtex blueprint.aux', env={'BIBINPUTS': '../doc'})
run('cd doc && xelatex -output-directory=../print blueprint.tex')
run('cd doc && xelatex -output-directory=../print blueprint.tex')
os.chdir(cwd)
@task
def qpdf(ctx):
"""Quick pdf (don't try to rebuild references)"""
cwd = os.getcwd()
os.chdir(ROOT)
run('mkdir -p print && cd doc && xelatex -output-directory=../print blueprint.tex')
os.chdir(cwd)
@task
def decls(ctx):
from mathlibtools.lib import LeanProject
"""Rebuild the Lean declarations database"""
proj = LeanProject.from_path(ROOT.resolve())
proj.build()
proj.pickle_decls(ROOT/'decls.pickle')
@task(decls, pdf)
def web(ctx):
"""Builds the web version in the web folder"""
cwd = os.getcwd()
os.chdir(ROOT)
run('cp print/blueprint.bbl doc/web.bbl')
os.chdir(ROOT/'doc')
run('plastex -c plastex.cfg web.tex')
os.chdir(cwd)
@task
def qweb(ctx):
"""Quick web (don't try to rebuild references or links to Lean code)"""
cwd = os.getcwd()
os.chdir(ROOT/'doc')
run('plastex -c plastex.cfg web.tex')
os.chdir(cwd)
@task
def serve(ctx):
"""Locally serve the web version (useful to see the dep graph)"""
cwd = os.getcwd()
os.chdir(ROOT/'web')
Handler = http.server.SimpleHTTPRequestHandler
httpd = socketserver.TCPServer(("", 8000), Handler)
httpd.serve_forever()
os.chdir(cwd)