]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - install.py
added install.py; updated COMPILING; fixed q3 shader transparency rendering; jedi...
[xonotic/netradiant.git] / install.py
1
2 import os
3 import shutil
4
5
6 def copyFile(source, target):
7   assert os.path.isfile(source)
8   targetFile = target
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)
13   
14 def copyFileIfExists(source, target):
15   if os.path.exists(source):
16     copyFile(source, target)
17     
18 def copySvn(source, target):
19   assert os.path.isdir(source)
20   if not os.path.exists(target):
21     os.mkdir(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):
26       if name != ".svn":
27         copySvn(absolute, absTarget)
28     else:
29       copyFile(absolute, absTarget)
30       
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):
40       os.mkdir(gamesDir)
41     copyFile(os.path.join(root, "games", gamename), os.path.join(gamesDir, gamename))  
42   
43 thisDir = os.path.dirname(__file__)
44 gamesRoot = os.path.join(thisDir, "games")
45 installRoot = os.path.join(thisDir, "install")
46
47 if not os.path.exists(installRoot):
48   os.mkdir(installRoot)
49   
50 # copy generic data
51 copySvn(os.path.join(thisDir, os.path.normpath("setup/data/tools")), installRoot)
52
53 # root, gamename
54 games = [
55   ("Doom3Pack/tools", "doom3"),
56   ("ETPack", "et"),
57   ("HalfLifePack", "hl"),
58   ("Her2Pack", "heretic2"),
59   ("JAPack/Tools", "ja"),
60   ("JK2Pack", "jk2"),
61   ("Q1Pack", "q1"),
62   ("Q2Pack", "q2"),
63   ("Q3Pack/tools", "q3"),
64   ("Q4Pack/tools", "q4"),
65   ("Sof2Pack", "sof2"),
66   ("STVEFPack", "stvef"),
67   ("WolfPack/bin", "wolf")
68 ]
69
70 # copy games
71 for game in games:
72   copyGame(gamesRoot, game, installRoot)
73
74 # copy win32 dlls
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)
78   
79 libxml2 = os.path.normpath(os.path.join(thisDir, "../libxml2-2.6/win32/install/libxml2.dll"))
80 copyFileIfExists(libxml2, installRoot)
81   
82 libpng = os.path.normpath(os.path.join(thisDir, "../libpng-1.2/lib/libpng13.dll"))
83 copyFileIfExists(libpng, installRoot)
84   
85 libmhash = os.path.normpath(os.path.join(thisDir, "../mhash-0.9/win32/libmhash/Release/libmhash.dll"))
86 copyFileIfExists(libmhash, installRoot)
87   
88 zlib = os.path.normpath(os.path.join(thisDir, "../zlib1-1.2/zlib1.dll"))
89 copyFileIfExists(zlib, installRoot)