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'] |
2f2dc328 RD |
10 | dllVer = '23_0' |
11 | wxpVer = '2.3b1' | |
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 | |
2f2dc328 | 74 | logSeparator("Building wxWindows...") |
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) | |
2f2dc328 | 83 | do('b.bat c') |
1b55cabf | 84 | |
2f2dc328 | 85 | logSeparator("Building wxPython...") |
f6bcfd97 | 86 | os.chdir(WXPYDIR + '\\src') |
2f2dc328 | 87 | do("b.bat f") |
f6bcfd97 | 88 | validateFile(WXPYDIR+'\\wxPython\\wxc.pyd') |
1b55cabf RD |
89 | |
90 | ||
1b55cabf | 91 | logSeparator("Building installer executable...") |
f6bcfd97 | 92 | os.chdir(WXPYDIR+'\\distrib') |
1b55cabf | 93 | do("autoit2 wise.aut") |
f6bcfd97 BP |
94 | srcName = WXPYDIR+'\\distrib\\wxPython-'+wxpVer+'.EXE' |
95 | destName = WXPYDIR+'\\distrib\\wxPython-'+wxpVer+'-'+dateSt+'.EXE' | |
1b55cabf RD |
96 | validateFile(srcName) |
97 | try: | |
eec92d76 | 98 | time.sleep(5) |
1b55cabf | 99 | os.rename(srcName, destName) |
eec92d76 | 100 | validateFile(destName) |
1b55cabf | 101 | except: |
f6bcfd97 | 102 | logSeparator("****** UNABLE TO RENAME FILE ******") |
1b55cabf RD |
103 | |
104 | ||
2f2dc328 | 105 | logSeparator("Building docs zip file...") |
f6bcfd97 BP |
106 | os.chdir(WXPYDIR) |
107 | do("distrib\\zipit.bat %s" % wxpVer) | |
1b55cabf | 108 | |
2f2dc328 RD |
109 | srcDName = WXPYDIR+'\\distrib\\wxPython-docs-'+wxpVer+'.tar.gz' |
110 | destDName = WXPYDIR+'\\distrib\\wxPython-docs-'+wxpVer+'-'+dateSt+'.tar.gz' | |
714d23b4 RD |
111 | validateFile(srcDName) |
112 | try: | |
113 | os.rename(srcDName, destDName) | |
114 | except: | |
115 | pass | |
1b55cabf | 116 | |
eec92d76 | 117 | |
f6bcfd97 | 118 | |
714d23b4 | 119 | # #*#*#*#*#* Comment this out to allow upload... |
2f2dc328 | 120 | #return |
eec92d76 | 121 | |
1b55cabf | 122 | logSeparator("Uploading to website...") |
f6bcfd97 | 123 | do('python c:\\utils\\sendwxp.py %s' % destName) |
2f2dc328 | 124 | #do('python c:\\utils\\sendwxp.py %s' % destDName) |
1b55cabf RD |
125 | |
126 | ||
127 | logSeparator("Finished!!!") | |
128 | ||
129 | finally: | |
130 | os.system("list " + logfile) | |
131 | pass | |
132 | ||
133 | ||
134 | ||
135 | ||
136 | ||
137 | ||
138 | if __name__ == '__main__': | |
139 | main() |