second merge of the 2.2 branch (RL)
[wxWidgets.git] / wxPython / distrib / autobuild.py
1
2
3 import sys, os, string, time
4 from ftplib import FTP
5
6 cwd = os.getcwd()
7
8 logfile = 'c:\\temp\\autobuild.log'
9 WXDIR = os.environ['WXWIN']
10 dllVer = '22_0'
11 wxpVer = '2.2.0'
12 dateSt = time.strftime("%Y%m%d", time.localtime(time.time()))
13
14 base = os.path.split(sys.argv[0])[0]
15 base = os.path.join(base, '..')
16 WXPYDIR = os.path.abspath(base)
17
18 #----------------------------------------------------------------------
19
20 def do(cmd):
21 st = " " + cmd + " >> " + logfile
22 print st
23 f = open(logfile, "at")
24 f.write(st + '\n')
25 f.close()
26 os.system(cmd + " >>& " + logfile)
27
28 #----------------------------------------------------------------------
29
30 def logTruncate():
31 f = open(logfile, "wt")
32 f.close()
33
34
35 def logSeparator(msg=None, f=None, recurse=1):
36 if not f:
37 f = open(logfile, "at")
38 f.write('\n')
39 f.write('--' * 35)
40 f.write('\n')
41 if msg:
42 f.write(msg)
43 f.write('\n')
44 f.write('--' * 35)
45 f.write('\n')
46 if recurse:
47 logSeparator(msg, sys.stdout, 0)
48
49 #----------------------------------------------------------------------
50
51 def validateFile(file):
52 if not os.path.exists(file):
53 logSeparator("***** %s does not exist, exiting! *****" % file)
54 raise SystemExit
55 else:
56 logSeparator("%s found, continuing..." % file, recurse=0)
57
58
59 #----------------------------------------------------------------------
60
61 def main():
62 logTruncate()
63
64 try:
65 logSeparator("Cleanup")
66 os.chdir(WXDIR + '/src/msw')
67 do('make cleandll FINAL=1')
68
69 logSeparator("Building Documentation...")
70 os.chdir(WXDIR + '/src/msw')
71 do('make touchmanual htmlhelp')
72 validateFile(WXDIR + '/docs/htmlhelp/wx.chm')
73
74 logSeparator("Building wxWindows and other libraries...")
75 os.chdir(WXDIR + '/src/msw')
76 do('make dll pch FINAL=1')
77 validateFile(WXDIR + '/lib/wx'+dllVer+'.dll')
78
79
80
81 logSeparator("Cleaning wxPython build directory...")
82 os.chdir(WXPYDIR)
83 do('buildall.bat -c')
84 os.rename('build.local', 'build.local.save')
85 f = open("build.local", "w")
86 f.write("""
87 CRTFLAG='/MD'
88 FINAL=1
89 """)
90 f.close()
91
92
93 logSeparator("Building core wxPython...")
94 os.chdir(WXPYDIR + '\\src')
95 do("build -b")
96 validateFile(WXPYDIR+'\\wxPython\\wxc.pyd')
97
98
99 logSeparator("Building wxPython addon modules...")
100 os.chdir(WXPYDIR+'\\contrib')
101 do("buildall -b")
102 validateFile(WXPYDIR+'\\wxPython\\glcanvasc.pyd')
103 validateFile(WXPYDIR+'\\wxPython\\oglc.pyd')
104 validateFile(WXPYDIR+'\\wxPython\\stc_c.pyd')
105
106
107 os.chdir(WXPYDIR)
108 os.unlink('build.local')
109 os.rename('build.local.save', 'build.local')
110
111
112 logSeparator("Building installer executable...")
113 os.chdir(WXPYDIR+'\\distrib')
114 do("autoit2 wise.aut")
115 srcName = WXPYDIR+'\\distrib\\wxPython-'+wxpVer+'.EXE'
116 destName = WXPYDIR+'\\distrib\\wxPython-'+wxpVer+'-'+dateSt+'.EXE'
117 validateFile(srcName)
118 try:
119 time.sleep(5)
120 os.rename(srcName, destName)
121 validateFile(destName)
122 except:
123 logSeparator("****** UNABLE TO RENAME FILE ******")
124
125
126 logSeparator("Building source and docs zip files...")
127 os.chdir(WXPYDIR)
128 do("distrib\\zipit.bat %s" % wxpVer)
129 srcZName = WXPYDIR+'\\distrib\\wxPython-src-'+wxpVer+'.zip'
130 destZName = WXPYDIR+'\\distrib\\wxPython-src-'+wxpVer+'-'+dateSt+'.zip'
131 validateFile(srcZName)
132 try:
133 os.rename(srcZName, destZName)
134 except:
135 pass
136
137 srcDName = WXPYDIR+'\\distrib\\wxPython-docs-'+wxpVer+'.zip'
138 destDName = WXPYDIR+'\\distrib\\wxPython-docs-'+wxpVer+'-'+dateSt+'.zip'
139 validateFile(srcDName)
140 try:
141 os.rename(srcDName, destDName)
142 except:
143 pass
144
145
146
147 # #*#*#*#*#* Comment this out to allow upload...
148 return
149
150 logSeparator("Uploading to website...")
151 do('python c:\\utils\\sendwxp.py %s' % destName)
152 do('python c:\\utils\\sendwxp.py %s' % destZName)
153 do('python c:\\utils\\sendwxp.py %s' % destDName)
154
155
156 logSeparator("Finished!!!")
157
158 finally:
159 os.system("list " + logfile)
160 pass
161
162
163
164
165
166
167 if __name__ == '__main__':
168 main()