]>
Commit | Line | Data |
---|---|---|
1b55cabf RD |
1 | |
2 | ||
3 | import sys, os, string, time | |
4 | from ftplib import FTP | |
5 | ||
f6bcfd97 | 6 | cwd = os.getcwd() |
1b55cabf | 7 | |
f6bcfd97 | 8 | logfile = 'c:\\temp\\autobuild.log' |
1b55cabf | 9 | WXDIR = os.environ['WXWIN'] |
f6bcfd97 BP |
10 | dllVer = '21_16' |
11 | wxpVer = '2.1.16' | |
1b55cabf RD |
12 | dateSt = time.strftime("%Y%m%d", time.localtime(time.time())) |
13 | ||
f6bcfd97 BP |
14 | base = os.path.split(sys.argv[0])[0] |
15 | base = os.path.join(base, '..') | |
16 | WXPYDIR = os.path.abspath(base) | |
17 | ||
1b55cabf RD |
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') | |
1b55cabf RD |
68 | |
69 | logSeparator("Building Documentation...") | |
70 | os.chdir(WXDIR + '/src/msw') | |
71 | do('make touchmanual htmlhelp') | |
f6bcfd97 | 72 | validateFile(WXDIR + '/docs/htmlhelp/wx.chm') |
1b55cabf | 73 | |
f6bcfd97 | 74 | logSeparator("Building wxWindows and other libraries...") |
1b55cabf RD |
75 | os.chdir(WXDIR + '/src/msw') |
76 | do('make dll pch FINAL=1') | |
77 | validateFile(WXDIR + '/lib/wx'+dllVer+'.dll') | |
78 | ||
1b55cabf RD |
79 | |
80 | ||
f6bcfd97 BP |
81 | logSeparator("Cleaning wxPython build directory...") |
82 | os.chdir(WXPYDIR) | |
83 | do('buildall.bat -c') | |
84 | os.rename('build.local', 'build.local.save') | |
1b55cabf RD |
85 | f = open("build.local", "w") |
86 | f.write(""" | |
1b55cabf RD |
87 | CRTFLAG='/MD' |
88 | FINAL=1 | |
89 | """) | |
90 | f.close() | |
91 | ||
92 | ||
1b55cabf | 93 | logSeparator("Building core wxPython...") |
f6bcfd97 BP |
94 | os.chdir(WXPYDIR + '\\src') |
95 | do("build -b") | |
96 | validateFile(WXPYDIR+'\\wxPython\\wxc.pyd') | |
1b55cabf RD |
97 | |
98 | ||
99 | logSeparator("Building wxPython addon modules...") | |
f6bcfd97 BP |
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') | |
1b55cabf RD |
110 | |
111 | ||
112 | logSeparator("Building installer executable...") | |
f6bcfd97 | 113 | os.chdir(WXPYDIR+'\\distrib') |
1b55cabf | 114 | do("autoit2 wise.aut") |
f6bcfd97 BP |
115 | srcName = WXPYDIR+'\\distrib\\wxPython-'+wxpVer+'.EXE' |
116 | destName = WXPYDIR+'\\distrib\\wxPython-'+wxpVer+'-'+dateSt+'.EXE' | |
1b55cabf RD |
117 | validateFile(srcName) |
118 | try: | |
eec92d76 | 119 | time.sleep(5) |
1b55cabf | 120 | os.rename(srcName, destName) |
eec92d76 | 121 | validateFile(destName) |
1b55cabf | 122 | except: |
f6bcfd97 | 123 | logSeparator("****** UNABLE TO RENAME FILE ******") |
1b55cabf RD |
124 | |
125 | ||
714d23b4 | 126 | logSeparator("Building source and docs zip files...") |
f6bcfd97 BP |
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' | |
1b55cabf RD |
131 | validateFile(srcZName) |
132 | try: | |
133 | os.rename(srcZName, destZName) | |
134 | except: | |
135 | pass | |
136 | ||
f6bcfd97 BP |
137 | srcDName = WXPYDIR+'\\distrib\\wxPython-docs-'+wxpVer+'.zip' |
138 | destDName = WXPYDIR+'\\distrib\\wxPython-docs-'+wxpVer+'-'+dateSt+'.zip' | |
714d23b4 RD |
139 | validateFile(srcDName) |
140 | try: | |
141 | os.rename(srcDName, destDName) | |
142 | except: | |
143 | pass | |
1b55cabf | 144 | |
eec92d76 | 145 | |
f6bcfd97 | 146 | |
714d23b4 | 147 | # #*#*#*#*#* Comment this out to allow upload... |
4c9993c3 | 148 | return |
eec92d76 | 149 | |
1b55cabf | 150 | logSeparator("Uploading to website...") |
f6bcfd97 BP |
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) | |
1b55cabf RD |
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() |