-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSnakefile
More file actions
46 lines (39 loc) · 1.21 KB
/
Copy pathSnakefile
File metadata and controls
46 lines (39 loc) · 1.21 KB
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
import os
os.environ["PATH"] = f"{os.getcwd()}/.venv/bin/:{os.environ['PATH']}"
shell.executable("/bin/bash")
def harmonize(p):
return str(p).replace('\\', '/')
PARTS = list(map(harmonize, Path('parts').glob('c_*.mkiv')))
IMGS = list(map(harmonize, [
*(p.with_suffix('.pdf') for p in Path('imgs').glob('*.ipynb')),
*Path('imgs').glob('*.tikz'),
*Path('imgs').glob('*.png'),
*Path('imgs').glob('*.svg'),
]))
rule context:
input:
tex='prd_dissertation.mkiv',
env='env_dissertation.mkiv',
prj='project_dissertation.mkiv',
bib='bib/prd_dissertation.bib',
parts=PARTS,
imgs=IMGS,
output:
'prd_dissertation.pdf',
run:
shell(f'context --nonstopmode --nostatistics --silent=all {input.tex}')
rule bib:
input:
bib='bib/library.bib',
conf='bib/bibtool.rsc',
output:
'bib/prd_dissertation.bib',
run:
shell(f'cd bib && bibtool -r biblatex -r {Path(input.conf).name} -i {Path(input.bib).name}')
rule img:
input:
'imgs/{name}.ipynb',
output:
'imgs/{name}.pdf',
run:
shell(f'cd imgs && jupyter nbconvert --execute --to=script --stdout {Path(input[0]).name}', read=True)