6 def copyFile(source, target):
7 assert os.path.isfile(source)
9 if os.path.isdir(targetFile):
10 targetFile = os.path.join(target, os.path.basename(source))
11 print source, "->", targetFile
12 shutil.copyfile(source, targetFile)
14 def copyFileIfExists(source, target):
15 if os.path.exists(source):
16 copyFile(source, target)
18 def copySvn(source, target):
19 assert os.path.isdir(source)
20 if not os.path.exists(target):
22 for name in os.listdir(source):
23 absolute = os.path.join(source, name)
24 absTarget = os.path.join(target, name)
25 if os.path.isdir(absolute):
27 copySvn(absolute, absTarget)
29 copyFile(absolute, absTarget)
31 def copyGame(source, game, target):
32 assert os.path.isdir(source)
33 assert os.path.isdir(target)
34 root = os.path.join(source, os.path.normpath(game[0]))
35 if os.path.exists(root):
36 gamename = game[1] + ".game"
37 copySvn(os.path.join(root, gamename), os.path.join(target, gamename))
38 gamesDir = os.path.join(target, "games")
39 if not os.path.exists(gamesDir):
41 copyFile(os.path.join(root, "games", gamename), os.path.join(gamesDir, gamename))
43 thisDir = os.path.dirname(__file__)
44 gamesRoot = os.path.join(thisDir, "games")
45 installRoot = os.path.join(thisDir, "install")
47 if not os.path.exists(installRoot):
51 copySvn(os.path.join(thisDir, os.path.normpath("setup/data/tools")), installRoot)
55 ("Doom3Pack/tools", "doom3"),
57 ("HalfLifePack", "hl"),
58 ("Her2Pack", "heretic2"),
59 ("JAPack/Tools", "ja"),
63 ("Q3Pack/tools", "q3"),
64 ("Q4Pack/tools", "q4"),
66 ("STVEFPack", "stvef"),
67 ("WolfPack/bin", "wolf")
72 copyGame(gamesRoot, game, installRoot)
75 gtk2Root = os.path.normpath(os.path.join(thisDir, "../gtk2-2.4"))
76 if os.path.exists(gtk2Root):
77 copySvn(os.path.join(gtk2Root, "install"), installRoot)
79 libxml2 = os.path.normpath(os.path.join(thisDir, "../libxml2-2.6/win32/install/libxml2.dll"))
80 copyFileIfExists(libxml2, installRoot)
82 libpng = os.path.normpath(os.path.join(thisDir, "../libpng-1.2/lib/libpng13.dll"))
83 copyFileIfExists(libpng, installRoot)
85 libmhash = os.path.normpath(os.path.join(thisDir, "../mhash-0.9/win32/libmhash/Release/libmhash.dll"))
86 copyFileIfExists(libmhash, installRoot)
88 zlib = os.path.normpath(os.path.join(thisDir, "../zlib1-1.2/zlib1.dll"))
89 copyFileIfExists(zlib, installRoot)