-
Notifications
You must be signed in to change notification settings - Fork 8
/
package.py
executable file
·45 lines (37 loc) · 917 Bytes
/
package.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
#!/usr/bin/env python3
# package the project
import os, shutil, subprocess
import mcd
files = [
'mcdsupport.py',
'mcd/__init__.py',
'mcd/addmcds.py',
'mcd/cloze.py',
'mcd/menus.py',
'mcd/models.py',
'mcd/dlgAddMcds.py',
]
def makeDirectories(pkg_dir):
os.mkdir( pkg_dir )
os.mkdir( pkg_dir + '/mcd' )
return
def copyFiles(pkg_dir):
for file in files:
dst = pkg_dir + '/' + file
shutil.copy( file, dst )
return
def main():
# build the directory/package name
pkg_dir = 'mcdsupport-v' + mcd.version
# create the directories and copy the files
makeDirectories(pkg_dir)
copyFiles(pkg_dir)
# zip everything up
cmd = 'cd '+pkg_dir+' ; zip -9r ../'+pkg_dir+'.zip .'
print(cmd)
subprocess.call( cmd, shell=True )
# clean up
shutil.rmtree( pkg_dir )
return
if __name__ == '__main__':
main()