-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwscript
35 lines (28 loc) · 1.14 KB
/
wscript
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
#!/usr/bin/env python
top = '.'
out = "build"
def configure(conf):
conf.load('tex')
if not conf.env.PDFLATEX:
conf.fatal("Could not find pdflatex")
def build(ctx):
ctx(
features = 'tex',
type = 'pdflatex', # pdflatex or xelatex
source = 'pdfposter.tex', # mandatory, the source
outs = 'pdf', # 'pdf' or 'ps pdf'
prompt = 0, # 0 for the batch mode
)
ctx.add_post_fun(post) # copy PDF, possibly view also
# add manual dependency such that the presentation is rebuilt if the style
# package pdfposter.sty changes:
ctx.add_manual_dependency(ctx.path.find_node('pdfposter.tex'), ctx.path.find_node('pdfposter.sty'))
def post(ctx):
print("Copy PDF file to top directory")
ctx.exec_command("cp {0}/pdfposter.pdf".format(out) + " {0}".format(top))
if ctx.options.view:
print("Open PDF file in default PDF viewer")
ctx.exec_command("xdg-open {0}/pdfposter.pdf".format(out))
def options(ctx):
ctx.add_option("--view", action="store_true", default=False,
help='view the PDf after it is built')