forked from geraldspreer/the-maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
compile_win.py
60 lines (52 loc) · 1.88 KB
/
compile_win.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
#script to create folder structure for windows distribution
#and compile python files to windows maker.exe using py2exe
#all folders (except .svn folders)and files from system are copied to dist
#maker.exe.manfest copied to dist
#all .txt files except path.txt copied to dist
#Ian Barrow 11/11/2007
import sys
import os
import shutil
from distutils.core import setup
import py2exe
path="system"
dst_root= ".\\dist\\"
def moveFiles(dirList, src_path_string, dst_path_string):
if dirList !=[]:
print " copying files:"
for files in dirList:
shutil.copy(src_path_string+files, dst_path_string+files)
print src_path_string+files+" To "+dst_path_string+files
def createDirectory(dirEntry):
src_path_string=dirEntry[0] + "\\"
dst_path_string=dst_root+dirEntry[0] + "\\"
if ".svn" not in src_path_string:
print " creating folder:",
print dst_path_string
os.mkdir(dst_path_string)
moveFiles(dirEntry[2], src_path_string,dst_path_string)
elif ".svn" in src_path_string:
print "ignoring "+src_path_string
print "deleting "+dst_root+" folder tree and files"
shutil.rmtree(dst_root,1)#,1 to ignor any errors ie no folders to remove
print "creating new "+dst_root+" folder for system tree"
os.mkdir(dst_root)
tree=os.walk(path)
for directory in tree:
createDirectory(directory)
print "copying maker.exe.manifest and other .txt files to dist except path.txt"
shutil.copy("maker.exe.manifest",dst_root+"maker.exe.manifest")
directory=os.listdir(".")
for item in directory:
if item[-4:]==".txt" and item!="path.txt":
shutil.copy(item,dst_root+item)
print "compiling...."
sys.argv.append("py2exe")
setup(
windows = [
{
"script": "maker.py",
"icon_resources": [(1, "system/tags.ico")]
}
],
)