2006-02-12 19:47:01 +00:00
|
|
|
# Copyright (C) 2001-2006 William Joseph.
|
2006-05-13 12:25:54 +00:00
|
|
|
#
|
2006-02-12 19:47:01 +00:00
|
|
|
# This file is part of GtkRadiant.
|
2006-05-13 12:25:54 +00:00
|
|
|
#
|
2006-02-12 19:47:01 +00:00
|
|
|
# GtkRadiant is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
2006-05-13 12:25:54 +00:00
|
|
|
#
|
2006-02-12 19:47:01 +00:00
|
|
|
# GtkRadiant is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
2006-05-13 12:25:54 +00:00
|
|
|
#
|
2006-02-12 19:47:01 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with GtkRadiant; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
|
|
|
|
"""
|
|
|
|
Builds the ./install directory.
|
|
|
|
|
|
|
|
Copies files from various locations:
|
|
|
|
./setup/data/tools/
|
|
|
|
./games/<gamepack>/
|
|
|
|
./include/version.default is used to generate RADIANT_MAJOR and RADIANT_MINOR
|
|
|
|
"""
|
2006-02-11 23:57:16 +00:00
|
|
|
|
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
|
2006-02-12 19:47:01 +00:00
|
|
|
def assertMessage(condition, message):
|
|
|
|
if not condition:
|
|
|
|
raise Exception(message)
|
2006-05-13 12:25:54 +00:00
|
|
|
|
2006-02-11 23:57:16 +00:00
|
|
|
def copyFile(source, target):
|
2006-02-12 19:47:01 +00:00
|
|
|
assertMessage(os.path.isfile(source), "failed to find file: " + source)
|
2006-02-24 21:29:42 +00:00
|
|
|
print source, "->", target
|
|
|
|
shutil.copy2(source, target)
|
2006-05-13 12:25:54 +00:00
|
|
|
|
2006-02-11 23:57:16 +00:00
|
|
|
def copyFileIfExists(source, target):
|
|
|
|
if os.path.exists(source):
|
|
|
|
copyFile(source, target)
|
2006-05-13 12:25:54 +00:00
|
|
|
|
2006-02-11 23:57:16 +00:00
|
|
|
def copySvn(source, target):
|
2006-02-12 19:47:01 +00:00
|
|
|
assertMessage(os.path.isdir(source), "failed to find directory: " + source)
|
2006-02-11 23:57:16 +00:00
|
|
|
if not os.path.exists(target):
|
|
|
|
os.mkdir(target)
|
|
|
|
for name in os.listdir(source):
|
|
|
|
absolute = os.path.join(source, name)
|
|
|
|
absTarget = os.path.join(target, name)
|
|
|
|
if os.path.isdir(absolute):
|
|
|
|
if name != ".svn":
|
|
|
|
copySvn(absolute, absTarget)
|
|
|
|
else:
|
|
|
|
copyFile(absolute, absTarget)
|
2006-05-13 12:25:54 +00:00
|
|
|
|
2006-02-11 23:57:16 +00:00
|
|
|
def copyGame(source, game, target):
|
2006-02-12 19:47:01 +00:00
|
|
|
assertMessage(os.path.isdir(source), "failed to find directory: " + source)
|
|
|
|
assertMessage(os.path.isdir(target), "failed to find directory: " + target)
|
2006-02-11 23:57:16 +00:00
|
|
|
root = os.path.join(source, os.path.normpath(game[0]))
|
|
|
|
if os.path.exists(root):
|
|
|
|
gamename = game[1] + ".game"
|
|
|
|
copySvn(os.path.join(root, gamename), os.path.join(target, gamename))
|
|
|
|
gamesDir = os.path.join(target, "games")
|
|
|
|
if not os.path.exists(gamesDir):
|
|
|
|
os.mkdir(gamesDir)
|
2006-05-13 12:25:54 +00:00
|
|
|
copyFile(os.path.join(root, "games", gamename), os.path.join(gamesDir, gamename))
|
|
|
|
|
2006-02-11 23:57:16 +00:00
|
|
|
thisDir = os.path.dirname(__file__)
|
|
|
|
gamesRoot = os.path.join(thisDir, "games")
|
|
|
|
installRoot = os.path.join(thisDir, "install")
|
|
|
|
|
|
|
|
if not os.path.exists(installRoot):
|
|
|
|
os.mkdir(installRoot)
|
2006-05-13 12:25:54 +00:00
|
|
|
|
2006-02-11 23:57:16 +00:00
|
|
|
# copy generic data
|
|
|
|
copySvn(os.path.join(thisDir, os.path.normpath("setup/data/tools")), installRoot)
|
|
|
|
|
|
|
|
# root, gamename
|
|
|
|
games = [
|
|
|
|
("Doom3Pack/tools", "doom3"),
|
|
|
|
("ETPack", "et"),
|
|
|
|
("HalfLifePack", "hl"),
|
|
|
|
("Her2Pack", "heretic2"),
|
|
|
|
("JAPack/Tools", "ja"),
|
|
|
|
("JK2Pack", "jk2"),
|
|
|
|
("Q1Pack", "q1"),
|
|
|
|
("Q2Pack", "q2"),
|
|
|
|
("Q3Pack/tools", "q3"),
|
|
|
|
("Q4Pack/tools", "q4"),
|
|
|
|
("Sof2Pack", "sof2"),
|
|
|
|
("STVEFPack", "stvef"),
|
2006-05-13 12:25:54 +00:00
|
|
|
("WolfPack/bin", "wolf"),
|
|
|
|
("NexuizPack", "nexuiz"),
|
2006-12-17 13:49:19 +00:00
|
|
|
("DarkPlacesPack", "darkplaces"),
|
|
|
|
("WarsowPack/tools", "warsow")
|
2006-02-11 23:57:16 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
# copy games
|
|
|
|
for game in games:
|
|
|
|
copyGame(gamesRoot, game, installRoot)
|
|
|
|
|
|
|
|
# copy win32 dlls
|
2007-02-28 20:55:39 +00:00
|
|
|
gtk2Root = os.path.normpath(os.path.join(thisDir, "../gtk2-2.10/install"))
|
2006-02-11 23:57:16 +00:00
|
|
|
if os.path.exists(gtk2Root):
|
2007-02-28 20:55:39 +00:00
|
|
|
copySvn(gtk2Root, installRoot)
|
2006-07-09 14:09:19 +00:00
|
|
|
|
|
|
|
libxml2 = os.path.normpath(os.path.join(thisDir, "../libxml2-2.6/bin/libxml2.dll"))
|
2006-02-11 23:57:16 +00:00
|
|
|
copyFileIfExists(libxml2, installRoot)
|
2006-05-13 12:25:54 +00:00
|
|
|
|
2006-02-11 23:57:16 +00:00
|
|
|
libmhash = os.path.normpath(os.path.join(thisDir, "../mhash-0.9/win32/libmhash/Release/libmhash.dll"))
|
|
|
|
copyFileIfExists(libmhash, installRoot)
|
2006-05-13 12:25:54 +00:00
|
|
|
|
2007-03-03 18:01:05 +00:00
|
|
|
copySvn("../msvc_redist", installRoot)
|
2006-02-12 19:47:01 +00:00
|
|
|
|
|
|
|
dbghelp = os.path.normpath(os.path.join(thisDir, "../msvc_redist/dbghelp.dll"))
|
|
|
|
copyFileIfExists(dbghelp, installRoot)
|
|
|
|
|
|
|
|
# create version files
|
|
|
|
version = open(os.path.join(thisDir, "include/version.default"), "rt").readline().split(".")
|
|
|
|
assertMessage(len(version) == 3, "failed to parse include/version.default")
|
|
|
|
open(os.path.join(thisDir, "install/RADIANT_MAJOR"), "wt").write(str(version[1]))
|
|
|
|
open(os.path.join(thisDir, "install/RADIANT_MINOR"), "wt").write(str(version[2]))
|