forked from materialsvirtuallab/pyhull
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
executable file
·67 lines (55 loc) · 1.9 KB
/
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
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
64
65
66
67
#!/usr/bin/env python
'''
Created on Apr 29, 2012
'''
from __future__ import division
__author__ = "Shyue Ping Ong"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "0.1"
__maintainer__ = "Shyue Ping Ong"
__email__ = "[email protected]"
__date__ = "Apr 29, 2012"
import os
import glob
from fabric.api import local, lcd
from fabric.state import env
def make_doc():
with lcd("docs"):
local("sphinx-apidoc -o . -f ../pyhull")
local("rm pyhull*tests.rst")
for f in glob.glob("docs/*.rst"):
if f.startswith('docs/pyhull') and f.endswith('rst'):
newoutput = []
suboutput = []
subpackage = False
with open(f, 'r') as fid:
for line in fid:
clean = line.strip()
if clean == "Subpackages":
subpackage = True
if not subpackage and not clean.endswith("tests"):
newoutput.append(line)
else:
if not clean.endswith("tests"):
suboutput.append(line)
if clean.startswith("pyhull") and not clean.endswith("tests"):
newoutput.extend(suboutput)
subpackage = False
suboutput = []
with open(f, 'w') as fid:
fid.write("".join(newoutput))
local("make html")
local("cp favicon.png _build/html/static")
def publish():
local("python setup.py release")
def test():
local("nosetests")
def setver():
from pyhull import __version__
local("sed s/version=.*,/version=\\\"{}\\\",/ setup.py > newsetup".format(__version__))
local("mv newsetup setup.py")
def release():
setver()
test()
make_doc()
publish()