forked from andyfriesen/ika
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakedist.py
155 lines (103 loc) · 3.64 KB
/
makedist.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import sys
import os, os.path
import shutil
import pysvn
from shutil import copy, copyfile
from zipfile import ZipFile, is_zipfile
def zip_files(src, dest_name=None, dest_zip=None, folder=''):
if dest_zip is None:
z = ZipFile(dest_name, "w")
else:
z = dest_zip
for file in os.listdir(src):
full_src = src + "/" + file
if os.path.isdir(full_src):
zip_files(full_src, dest_zip=z, folder=folder + file + "/")
else:
z.write(src + '/' + file, folder + file)
if dest_zip is None:
z.close()
return z
def copy_files(src_path, dest_path):
if not os.path.exists(dest_path):
os.mkdir(dest_path)
for file in os.listdir(src_path):
full_src = src_path + "/" + file
full_dest = dest_path + "/" + file
if file == '.svn':
continue
if os.path.isdir(full_src):
os.mkdir(full_dest)
copy_files(full_src, full_dest)
else:
copyfile(src_path + "/" + file, dest_path + "/" + file)
if len(sys.argv) == 1:
print "Needs a version, dummy!"
sys.exit()
else:
version = sys.argv[1]
"""
Create our folders here.
"""
path = os.path.dirname(__file__) + '/'
makedist_path = path + 'makedist_temp'
win_path = makedist_path + '/ika-' + version
demo_path = win_path + '/sample'
core_path = makedist_path + '/core'
src_path = makedist_path + '/src'
if os.path.exists(makedist_path):
print "Temporary folder still exists. Deleting..."
shutil.rmtree(makedist_path)
# Create folders here
print "Creating temporary folders"
os.mkdir(makedist_path)
os.mkdir(win_path)
os.mkdir(demo_path)
os.mkdir(core_path)
os.mkdir(src_path)
# core.zip
print "Assembling core.zip"
copy("engine/Release/ika.exe", core_path)
copy("ikamap/Release/ikaMap.exe", core_path)
# Compress exes.
# zip files
zip_files(core_path, path + "ika-core-" + version + ".zip")
print "Done"
# Windows ZIP
print "Assembling Windows distribution"
copy("3rdparty/dlls/corona.dll", win_path)
#copy("3rdparty/dlls/msvcp90.dll", demo_path)
#copy("3rdparty/dlls/msvcr90.dll", demo_path)
copy("3rdparty/dlls/msvcp71.dll", win_path)
copy("3rdparty/dlls/msvcr71.dll", win_path)
copy("3rdparty/dlls/python25.dll", win_path)
copy("3rdparty/dlls/zlib.dll", win_path)
copy("3rdparty/dlls/sdl.dll", win_path)
#copy("3rdparty/dlls/Microsoft.VC90.CRT.manifest", demo_path)
copy("ikamap/Release/ikaMap.exe", win_path)
copy("3rdparty/dlls/audiere.dll", demo_path)
copy("3rdparty/dlls/corona.dll", demo_path)
copy("3rdparty/dlls/msvcp71.dll", demo_path)
copy("3rdparty/dlls/msvcr71.dll", demo_path)
copy("3rdparty/dlls/python25.dll", demo_path)
copy("3rdparty/dlls/sdl.dll", demo_path)
copy("3rdparty/dlls/zlib.dll", demo_path)
copy("engine/Release/ika.exe", demo_path)
copy_files(path + "sample", demo_path)
copy_files(path + "doc", win_path + "/doc")
zip_files(win_path, path + "ika-win-" + version + ".zip")
print "Done"
# Source
print "Assembling source"
client = pysvn.Client()
# Function to trust the SVN server.
def ssl_server_trust_prompt(trust):
return True, 1, True
client.callback_ssl_server_trust_prompt = ssl_server_trust_prompt
# Go through each folder and export it from SVN
for folder in ('common', 'engine', 'ikaMap'):
print "Exporting %s from repository" % folder
client.export('https://ika.svn.sourceforge.net/svnroot/ika/trunk/%s' % folder, src_path + '/' + folder)
zip_files(src_path, path + "ika-src-" + version + ".zip")
print "Removing files"
shutil.rmtree(makedist_path)