Added aqua_speed for rite geo 50 tryker
[ryzomcore.git] / nel / tools / build_gamedata / 1_export.py
blobb010d98aaf76b308894a58932e0406c3199dce9b
1 #!/usr/bin/python
2 #
3 # \file 1_export.py
4 # \brief Run all export processes
5 # \date 2009-02-18 09:22GMT
6 # \author Jan Boon (Kaetemi)
7 # Python port of game data build pipeline.
8 # Run all export processes
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, argparse
28 sys.path.append("configuration")
30 parser = argparse.ArgumentParser(description='Ryzom Core - Build Gamedata - Export')
31 # parser.add_argument('--haltonerror', '-eh', action='store_true')
32 parser.add_argument('--includeproject', '-ipj', nargs='+')
33 parser.add_argument('--excludeproject', '-epj', nargs='+')
34 parser.add_argument('--includeprocess', '-ipc', nargs='+')
35 parser.add_argument('--excludeprocess', '-epc', nargs='+')
36 args = parser.parse_args()
38 if not args.includeproject == None and not args.excludeproject == None:
39 print "ERROR --includeproject cannot be combined with --excludeproject, exit."
40 exit()
42 if not args.includeprocess == None and not args.excludeprocess == None:
43 print "ERROR --includeprocess cannot be combined with --excludeprocess, exit."
44 exit()
46 if os.path.isfile("log.log"):
47 os.remove("log.log")
48 log = open("log.log", "w")
49 from scripts import *
50 from buildsite_local import *
51 from tools import *
53 sys.path.append(WorkspaceDirectory)
54 from projects import *
56 # Log error
57 printLog(log, "")
58 printLog(log, "-------")
59 printLog(log, "--- Run the export processes")
60 printLog(log, "-------")
61 printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
62 printLog(log, "")
63 # For each project
64 for projectName in ProjectsToProcess:
65 if ((args.includeproject == None or projectName in args.includeproject) and (args.excludeproject == None or not projectName in args.excludeproject)):
66 printLog(log, "PROJECT " + projectName)
67 os.putenv("NELBUILDACTIVEPROJECT", os.path.abspath(WorkspaceDirectory + "/" + projectName))
68 os.chdir("processes")
69 try:
70 if not args.includeprocess == None:
71 subprocess.call([ "python", "1_export.py", "--includeprocess" ] + args.includeprocess)
72 elif not args.excludeprocess == None:
73 subprocess.call([ "python", "1_export.py", "--excludeprocess" ] + args.excludeprocess)
74 else:
75 subprocess.call([ "python", "1_export.py" ])
76 except Exception, e:
77 printLog(log, "<" + projectName + "> " + str(e))
78 os.chdir("..")
79 try:
80 projectLog = open("processes/log.log", "r")
81 projectLogData = projectLog.read()
82 projectLog.close()
83 log.write(projectLogData)
84 except Exception, e:
85 printLog(log, "<" + projectName + "> " + str(e))
86 else:
87 printLog(log, "IGNORE PROJECT " + projectName)
88 printLog(log, "")
90 log.close()
91 if os.path.isfile("1_export.log"):
92 os.remove("1_export.log")
93 shutil.copy("log.log", time.strftime("%Y-%m-%d-%H-%M-GMT", time.gmtime(time.time())) + "_export.log")
94 shutil.move("log.log", "1_export.log")