1 # install the fucking files
2 # check the md5 to decide for a copy
3 # we have a site.conf to go through
4 # and a data list of stuff
5 # it's called at the end of each build to copy what needs to be
6 # it could be called only at GtkRadiant link time
8 # command line: a bunch of config switches default would be debug?, and release flag
11 import sys, traceback, os, re, filecmp, shutil, pickle, string
12 from makeversion import get_version
14 (line, major, minor) = get_version()
17 'CORERADIANTDIR' : 'C:\\Program Files\\GtkRadiant-1.' + major,
18 'RTCWRADIANTDIR' : 'C:\\Program Files\\Return to Castle Wolfenstein - Game of The Year Edition\\Radiant-1.' + major,
19 'HLRADIANTDIR' : 'C:\\Sierra\\Half-Life\\Radiant-1.' + major,
20 'SOF2RADIANTDIR' : 'C:\\Program Files\\Soldier of Fortune II - Double Helix\\Radiant-1.' + major,
21 'QUAKE2RADIANTDIR' : 'C:\\Quake2\\Radiant-1.' + major,
22 'HERETIC2RADIANTDIR' : 'C:\\Heretic2\\Radiant-1.' + major
25 conf_filename='site.conf.win32'
27 # site settings ----------------------
29 if (os.path.exists(conf_filename)):
30 site_file = open(conf_filename, 'r')
31 p = pickle.Unpickler(site_file)
33 print 'Loaded configuration from ' + conf_filename
35 # end site settings ------------------
37 # command line overrides -------------
39 print '\nCommand line:'
40 regex = re.compile("(.*)=(.*)")
41 for i in sys.argv[1:]:
43 if ( regex.match(i) ):
44 (key, val) = string.split(i, '=')
45 #print 'key: %s val: %s' % (key, val)
48 print 'Can''t parse command line - ignore: ' + i
50 # end command line overrides ---------
52 # save config ------------------------
54 site_file = open(conf_filename, 'w')
55 p = pickle.Pickler(site_file)
59 print '\nConfiguration:'
61 for i in paths.keys():
62 print '%s -> %s' % (i, paths[i])
64 # end save config --------------------
67 # ( ( '..\\libpng\\projects\\msvc\\win32\\zlib\\dll_dbg\\zlibd.dll', '..\\libpng\\projects\\msvc\\win32\\zlib\\dll\\zlib.dll' ), '$CORERADIANTDIR' ),
68 # ( ( '..\\libpng\\projects\\msvc\\win32\\libpng\\dll_dbg\\libpng13d.dll', '..\\libpng\\projects\\msvc\\win32\\libpng\\dll\\libpng13.dll' ), '$CORERADIANTDIR' ),
69 # ( ( '..\\libxml2\\win32\\binaries-debug\\libxml2.dll', '..\\libxml2\\win32\\binaries-release\\libxml2.dll' ), '$CORERADIANTDIR' ),
70 ( ( 'tools\\quake3\\q3map2\\Debug\\Q3Map2.exe', 'tools\\quake3\\q3map2\\Release\\Q3Map2.exe' ), '$CORERADIANTDIR' ),
74 ( ( 'radiant\\Debug\\GtkRadiant.exe', 'radiant\\Release\\GtkRadiant.exe' ) , '$CORERADIANTDIR' ),
75 ( ( 'contrib\\bobtoolz\\Debug\\bobToolz.dll', 'contrib\\bobtoolz\\Release\\bobToolz.dll' ), '$CORERADIANTDIR\\plugins' ),
76 ( ( 'contrib\\camera\\Debug\\camera.dll', 'contrib\\camera\\Release\\camera.dll' ), '$CORERADIANTDIR\\plugins' ),
77 ( ( 'plugins\\entity\\Debug\\entity.dll', 'plugins\\entity\\Release\\entity.dll' ), '$CORERADIANTDIR\\modules' ),
78 ( ( 'plugins\\eclassfgd\\Debug\\fgd.dll', 'plugins\\eclassfgd\\Release\\fgd.dll' ), '$CORERADIANTDIR\\modules' ),
79 ( ( 'contrib\\gtkgensurf\\Debug\\gensurf.dll', 'contrib\\gtkgensurf\\Release\\gensurf.dll' ), '$CORERADIANTDIR\\plugins' ),
80 ( ( 'contrib\\hydratoolz\\Debug\\hydratoolz.dll', 'contrib\\hydratoolz\\Release\\hydratoolz.dll' ), '$HLRADIANTDIR\\plugins' ),
81 ( ( 'plugins\\image\\Debug\\image.dll', 'plugins\\image\\Release\\image.dll' ), '$CORERADIANTDIR\\modules' ),
82 ( ( 'plugins\\imagewal\\Debug\\imagewal.dll', 'plugins\\imagewal\\Release\\imagewal.dll' ), '$QUAKE2RADIANTDIR\\modules' ),
83 ( ( 'plugins\\imagehl\\Debug\\imagehl.dll', 'plugins\\imagehl\\Release\\imagehl.dll' ), '$CORERADIANTDIR\\modules' ),
84 ( ( 'plugins\\imagepng\\Debug\\imagepng.dll', 'plugins\\imagepng\\Release\\imagepng.dll' ), '$CORERADIANTDIR\\modules' ),
85 ( ( 'plugins\\map\\Debug\\map.dll', 'plugins\\map\\Release\\map.dll' ), '$CORERADIANTDIR\\modules' ),
86 ( ( 'plugins\\mapxml\\Debug\\mapxml.dll', 'plugins\\mapxml\\Release\\mapxml.dll' ), '$CORERADIANTDIR\\modules' ),
87 ( ( 'plugins\\model\\Debug\\model.dll', 'plugins\\model\\Release\\model.dll' ), '$CORERADIANTDIR\\modules' ),
88 ( ( 'contrib\\prtview\\Debug\\PrtView.dll', 'contrib\\prtview\\Release\\PrtView.dll' ), '$CORERADIANTDIR\\plugins' ),
89 ( ( 'tools\\quake3\\q3data\\Debug\\q3data.exe', 'tools\\quake3\\q3data\\Release\\q3data.exe' ), '$CORERADIANTDIR' ),
90 ( ( 'plugins\\shaders\\Debug\\shaders.dll', 'plugins\\shaders\\Release\\shaders.dll' ), '$CORERADIANTDIR\\modules' ),
91 ( ( 'plugins\\spritemodel\\Debug\\spritemodel.dll', 'plugins\\spritemodel\\Release\\spritemodel.dll' ), '$CORERADIANTDIR\\modules' ),
92 # ( ( 'Debug\\TexTool.dll', 'Release\\TexTool.dll' ), '$CORERADIANTDIR\\plugins' ),
93 ( ( 'plugins\\vfspk3\\Debug\\vfspk3.dll', 'plugins\\vfspk3\\Release\\vfspk3.dll' ), '$CORERADIANTDIR\\modules' ),
94 ( ( 'plugins\\vfspak\\Debug\\vfspak.dll', 'plugins\\vfspak\\Release\\vfspak.dll' ), '$QUAKE2RADIANTDIR\\modules' ),
95 ( ( 'plugins\\vfswad\\Debug\\vfswad.dll', 'plugins\\vfswad\\Release\\vfswad.dll' ), '$CORERADIANTDIR\\modules' ),
96 ( ( 'plugins\\surface\\Debug\\surface.dll', 'plugins\\surface\\Release\\surface.dll' ), '$CORERADIANTDIR\\modules' ),
97 ( ( 'plugins\\surface_quake2\\Debug\\surface_quake2.dll', 'plugins\\surface_quake2\\Release\\surface_quake2.dll' ), '$QUAKE2RADIANTDIR\\modules' ),
98 ( ( 'tools\\quake2\\q2map\\Debug\\q2map.exe', 'tools\\quake2\\q2map\\Release\\q2map.exe' ) , '$QUAKE2RADIANTDIR' ),
99 ( ( 'tools\\quake2\\qdata\\Debug\\qdata3.exe', 'tools\\quake2\\qdata\\Release\\qdata3.exe' ) , '$QUAKE2RADIANTDIR' ),
100 ( ( 'plugins\\vfspak\\Debug\\vfspak.dll', 'plugins\\vfspak\\Release\\vfspak.dll' ), '$HERETIC2RADIANTDIR\\modules' ),
101 ( ( 'plugins\\imagem8\\Debug\\imagem8.dll', 'plugins\\imagem8\\Release\\imagem8.dll' ), '$HERETIC2RADIANTDIR\\modules' ),
102 ( ( 'plugins\\surface_heretic2\\Debug\\surface_heretic2.dll', 'plugins\\surface_heretic2\\Release\\surface_heretic2.dll' ), '$HERETIC2RADIANTDIR\\modules' ),
103 ( ( 'tools\\quake2\\qdata_heretic2\\Debug\\qdata3.exe', 'tools\\quake2\\qdata_heretic2\\Release\\qdata3.exe' ) , '$HERETIC2RADIANTDIR' ),
104 ( ( 'contrib\\bkgrnd2d\\Debug\\bkgrnd2d.dll', 'contrib\\bkgrnd2d\\Release\\bkgrnd2d.dll' ), '$CORERADIANTDIR\\plugins' ),
112 if ( i == 'release' ):
114 elif ( i == 'q3map2' ):
118 print 'installing release binaries'
120 print 'installing debug binaries'
123 for matches in paths.keys():
124 exp = re.compile('\\$%s' % matches)
125 if ( not re.match(exp, path_in) is None ):
126 #print "Got a match for %s on %s" % ( matches, path_in )
127 path_in = re.sub(exp, paths[matches], path_in)
128 #print "Processed to: %s" % path_in
131 # don't bother about stderr
132 sys.stderr = sys.stdout
140 for entries in stuff:
142 src = expand(entries[0][config])
143 #print "src basename: %s -> %s" % (src, os.path.basename(src))
145 dst = os.path.join( entries[1], os.path.basename(src) )
147 #print "src: %s dst: %s" % (src, dst)
148 if (os.path.isfile(src)):
149 if (os.path.isfile(dst)):
150 if (not filecmp.cmp(src, dst)):
151 shutil.copy(src, dst)
152 print "%s: OK - updated" % dst
154 print "%s: OK - already up to date" % dst
156 shutil.copy(src, dst)
157 print "%s: OK - installed" % dst
159 print "%s: FAILED - not found" % src
160 if (os.path.isfile(dst)):
161 print "delete %s" % dst
164 print "%s: FAILED" % src
165 traceback.print_exc()