Skip to content

Commit 3514e46

Browse files
committed
Install all the mods
1 parent 283fb19 commit 3514e46

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

modanalyzer.py

+11-8
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,28 @@ def runServer():
5151
os.chdir(d)
5252
print "Server terminated"
5353

54-
def analyzeMod(fn, others=[]):
55-
print "Analyzing %s... (deps=%s)" % (getModName(fn), others)
56-
# clean
57-
modsFolder = os.path.join(TEST_SERVER_ROOT, "mods")
54+
def prepareCleanServerFolders(serverRoot):
55+
modsFolder = os.path.join(serverRoot, "mods")
5856
if os.path.exists(modsFolder):
5957
shutil.rmtree(modsFolder)
6058

61-
coremodsFolder = os.path.join(TEST_SERVER_ROOT, "coremods")
59+
coremodsFolder = os.path.join(serverRoot, "coremods")
6260
if os.path.exists(coremodsFolder):
6361
shutil.rmtree(coremodsFolder)
6462

6563
os.mkdir(modsFolder)
6664
os.mkdir(coremodsFolder)
67-
configFolder = os.path.join(TEST_SERVER_ROOT, "config")
65+
configFolder = os.path.join(serverRoot, "config")
6866
if os.path.exists(configFolder):
6967
shutil.rmtree(configFolder)
7068

69+
return modsFolder, coremodsFolder, configFolder
70+
71+
def analyzeMod(fn, others=[]):
72+
print "Analyzing %s... (deps=%s)" % (getModName(fn), others)
73+
# clean
74+
modsFolder, coremodsFolder, configFolder = prepareCleanServerFolders(TEST_SERVER_ROOT)
75+
7176
# install analyzer
7277
shutil.copyfile(os.path.join("target", ANALYZER_FILENAME), os.path.join(modsFolder, ANALYZER_FILENAME))
7378

@@ -322,8 +327,6 @@ def load():
322327

323328
return contents
324329

325-
326-
327330
def main():
328331
global fn2depsfn, forceRescan
329332

resolve.py

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/python
2+
3+
import os
4+
import sys
5+
6+
import modanalyzer
7+
8+
def main():
9+
wantedMods = map(lambda x: os.path.join(modanalyzer.ALL_MODS_DIR, x), os.listdir(modanalyzer.ALL_MODS_DIR))
10+
11+
contents = modanalyzer.load()
12+
13+
modsFolder, coremodsFolder, configFolder = modanalyzer.prepareCleanServerFolders(modanalyzer.TEST_SERVER_ROOT)
14+
15+
16+
for mod in wantedMods:
17+
if not contents.has_key(os.path.basename(mod)+".csv"):
18+
print "No mod analysis found for %s, please analyze" % (mod,)
19+
sys.exit(-1)
20+
21+
print "Installing",mod
22+
modanalyzer.installMod(mod, modsFolder, coremodsFolder)
23+
# TODO: resolve conflicts
24+
25+
#modanalyzer.runServer()
26+
27+
if __name__ == "__main__":
28+
main()

0 commit comments

Comments
 (0)