-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
49 lines (41 loc) · 1007 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import shutil
import fabric.api as f
from presenters import NAME, VERSION
name = NAME + VERSION
archive_name = name + '.zip'
f.env.hosts = ['[email protected]']
def build_exe():
f.local('pyinstaller pyinstaller.spec')
def build_doc():
f = open('doc/source.html')
doc = f.read().format(NAME=NAME, VERSION=VERSION)
f.close()
f = open('doc/index.html', 'w')
f.write(doc)
f.close()
def archive():
shutil.make_archive(
base_name = name,
format = 'zip',
root_dir = 'dist')
def upload():
remote_folder = 'host.host/utl/%s/' % NAME
f.put(archive_name, remote_folder)
f.put('doc/index.html', remote_folder)
def clean():
try: f.local('rm doc/index.html')
except: pass
try: f.local('rm ' + archive_name)
except: pass
try: f.local('rm -rf build/')
except: pass
try: f.local('rm -rf dist/')
except: pass
def build():
build_exe()
build_doc()
def publish():
build()
archive()
upload()
clean()