Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / nel / tools / build_gamedata / processes / properties / 0_setup.py
blob538cdffd58d8cd83b2fb353a5c83c05d679e2bd5
1 #!/usr/bin/python
2 #
3 # \file 0_setup.py
4 # \brief setup properties
5 # \date 2010-05-24 13:42GMT
6 # \author Jan Boon (Kaetemi)
7 # Python port of game data build pipeline.
8 # Setup properties
9 #
10 # NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
11 # Copyright (C) 2009-2014 by authors
13 # This program is free software: you can redistribute it and/or modify
14 # it under the terms of the GNU Affero General Public License as
15 # published by the Free Software Foundation, either version 3 of the
16 # License, or (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU Affero General Public License for more details.
23 # You should have received a copy of the GNU Affero General Public License
24 # along with this program. If not, see <http://www.gnu.org/licenses/>.
27 import time, sys, os, shutil, subprocess, distutils.dir_util
28 sys.path.append("../../configuration")
30 if os.path.isfile("log.log"):
31 os.remove("log.log")
32 log = open("log.log", "w")
33 from scripts import *
34 from buildsite import *
35 from process import *
36 from tools import *
37 from directories import *
39 printLog(log, "")
40 printLog(log, "-------")
41 printLog(log, "--- Setup properties")
42 printLog(log, "-------")
43 printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
44 printLog(log, "")
48 mkPath(log, ActiveProjectDirectory + "/generated")
49 zlp = open(ActiveProjectDirectory + "/generated/properties.cfg", "w")
50 zlp.write("\n")
51 zlp.write("// Search pathes\n")
52 zlp.write("search_pathes = \n")
53 zlp.write("{\n")
54 for searchPath in PropertiesExportBuildSearchPaths:
55 zlp.write("\t\"" + ExportBuildDirectory + "/" + searchPath + "\",\n")
56 zlp.write("};\n")
57 zlp.write("\n")
58 ps = open(ActiveProjectDirectory + "/properties_base.cfg", "r")
59 for line in ps:
60 try:
61 SmallbankExportDirectory
62 except NameError:
63 SmallbankExportDirectory = "_invalid"
64 try:
65 FarbankBuildDirectory
66 except NameError:
67 FarbankBuildDirectory = "_invalid"
68 try:
69 EcosystemName
70 except NameError:
71 EcosystemName = "_invalid"
72 try:
73 EcosystemPath
74 except NameError:
75 EcosystemPath = "_invalid"
76 try:
77 ContinentName
78 except NameError:
79 ContinentName = "_invalid"
80 try:
81 ContinentPath
82 except NameError:
83 ContinentPath = "_invalid"
84 try:
85 ContinentSheet
86 except NameError:
87 ContinentSheet = ContinentName
88 try:
89 BankTileBankName
90 except NameError:
91 BankTileBankName = "_invalid"
92 try:
93 IgLandBuildDirectory
94 except NameError:
95 IgLandBuildDirectory = "_invalid"
96 try:
97 IgOtherBuildDirectory
98 except NameError:
99 IgOtherBuildDirectory = "_invalid"
100 try:
101 RbankOutputBuildDirectory
102 except NameError:
103 RbankOutputBuildDirectory = "_invalid"
104 try:
105 RbankRbankName
106 except NameError:
107 RbankRbankName = "_invalid"
108 newline = line.replace("%ExportBuildDirectory%", ExportBuildDirectory)
109 newline = newline.replace("%LeveldesignDirectory%", LeveldesignDirectory)
110 newline = newline.replace("%LeveldesignWorldDirectory%", LeveldesignWorldDirectory)
111 newline = newline.replace("%LeveldesignDfnDirectory%", LeveldesignDfnDirectory)
112 newline = newline.replace("%SmallbankExportDirectory%", SmallbankExportDirectory)
113 newline = newline.replace("%FarbankBuildDirectory%", FarbankBuildDirectory)
114 newline = newline.replace("%EcosystemName%", EcosystemName)
115 newline = newline.replace("%EcosystemPath%", EcosystemPath)
116 newline = newline.replace("%ContinentName%", ContinentName)
117 newline = newline.replace("%ContinentPath%", ContinentPath)
118 newline = newline.replace("%CommonName%", CommonName)
119 newline = newline.replace("%CommonPath%", CommonPath)
120 newline = newline.replace("%ContinentSheet%", ContinentSheet)
121 newline = newline.replace("%BankTileBankName%", BankTileBankName)
122 newline = newline.replace("%IgLandBuildDirectory%", IgLandBuildDirectory)
123 newline = newline.replace("%IgOtherBuildDirectory%", IgOtherBuildDirectory)
124 newline = newline.replace("%RbankOutputBuildDirectory%", RbankOutputBuildDirectory)
125 newline = newline.replace("%RbankRbankName%", RbankRbankName)
126 newline = newline.replace("%BuildQuality%", str(BuildQuality))
127 zlp.write(newline)
128 ps.close()
129 if (BuildQuality == 1):
130 ps = open(ActiveProjectDirectory + "/properties_final.cfg", "r")
131 else:
132 ps = open(ActiveProjectDirectory + "/properties_draft.cfg", "r")
133 for line in ps:
134 zlp.write(line)
135 zlp.close()
136 printLog(log, "")
138 log.close()
141 # end of file