Merge branch 'main/rendor-staging' into fixes
[ryzomcore.git] / nel / tools / build_gamedata / processes / map / 3_install.py
blobfc4c525963638b393aec8bbb707f110403225aa8
1 #!/usr/bin/python
2 #
3 # \file 3_install.py
4 # \brief Install map
5 # \date 2009-03-10 13:13GMT
6 # \author Jan Boon (Kaetemi)
7 # Python port of game data build pipeline.
8 # Install map
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_local import *
35 from process import *
36 from tools import *
37 from directories import *
39 printLog(log, "")
40 printLog(log, "-------")
41 printLog(log, "--- Install map")
42 printLog(log, "-------")
43 printLog(log, time.strftime("%Y-%m-%d %H:%MGMT", time.gmtime(time.time())))
44 printLog(log, "")
46 installPath = InstallDirectory + "/" + MapInstallDirectory
47 mkPath(log, installPath)
49 printLog(log, ">>> Install map <<<")
50 sourcePaths = [ ExportBuildDirectory + "/" + MapBuildDirectory ] + [ ExportBuildDirectory + "/" + MapUncompressedExportDirectory ]
51 for sourcePath in sourcePaths:
52 mkPath(log, sourcePath)
53 files = os.listdir(sourcePath)
54 len_ext = 4
55 for fileName in files:
56 if isLegalFileName(fileName):
57 sourceFile = sourcePath + "/" + fileName
58 if os.path.isfile(sourceFile):
59 if (fileName[-len_ext:].lower() == ".tga") or (fileName[-len_ext:].lower() == ".png") or (fileName[-len_ext:].lower() == ".dds"):
60 copyFileIfNeeded(log, sourceFile, installPath + "/" + os.path.basename(fileName))
61 elif not os.path.isdir(sourceFile):
62 printLog(log, "FAIL ?! file not dir or file ?! " + sourceFile)
64 if MapPanoplyFileList != None:
65 printLog(log, ">>> Install panoply file list <<<")
66 buildPanoplyTagPath = ExportBuildDirectory + "/" + MapTagBuildDirectory + "/build_panoply.tag"
67 mkPath(log, ExportBuildDirectory + "/" + MapTagBuildDirectory)
68 if needUpdate(log, buildPanoplyTagPath, installPath + "/" + MapPanoplyFileList):
69 sourcePath = ExportBuildDirectory + "/" + MapPanoplyBuildDirectory
70 mkPath(log, sourcePath)
71 printLog(log, "WRITE " + installPath + "/" + MapPanoplyFileList)
72 lf = open(installPath + "/" + MapPanoplyFileList, "w")
73 files = os.listdir(sourcePath)
74 for file in files:
75 if isLegalFileName(file):
76 lf.write(file + "\n")
77 lf.close()
78 else:
79 printLog(log, "SKIP " + installPath + "/" + MapPanoplyBuildDirectory)
81 if MapHlsBankFileName != None:
82 printLog(log, ">>> Install map hlsbank <<<")
83 sourcePath = ExportBuildDirectory + "/" + MapPanoplyHlsBankBuildDirectory
84 mkPath(log, sourcePath)
85 copyFilesExtNoSubdirIfNeeded(log, sourcePath, installPath, ".hlsbank")
87 printLog(log, "")
88 log.close()
91 # end of file