-
Notifications
You must be signed in to change notification settings - Fork 2
/
fabfile.py
33 lines (25 loc) · 827 Bytes
/
fabfile.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
from __future__ import print_function
from zipfile import ZipFile
from fabric.api import local
from os import path
class Package(ZipFile):
def __init__(self, name, folder):
ZipFile.__init__(self, name, 'w')
self.folder = folder
def add(self, name, new_name=None):
if new_name == None:
new_name = name
self.write(name, path.join(self.folder, new_name))
def zip(zipfile='grid-system.zip'):
with Package(zipfile, 'grid-system') as zip:
zip.add('grid-system.pdf')
zip.add('grid-system.sty')
zip.add('grid-system.tex')
zip.add('README.md', 'README')
zip.add('LICENSE')
def build_missing_pdf():
if not path.exists('grid-system.pdf'):
local('pdflatex grid-system')
def default():
build_missing_pdf()
zip()