forked from chesko256/Campfire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmanifestcheck.py
61 lines (53 loc) · 2.25 KB
/
manifestcheck.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import sys
import os.path
from os import listdir
from os.path import isfile, join
def ParseManifest():
with open("./" + sys.argv[1]) as manifest:
lines = manifest.readlines()
all_files_present = True
for line in lines:
if not os.path.isfile(".\\" + line.rstrip('\n')):
print " " + str(line.rstrip('\n').replace('//', '/') + " was not found in the project directory.")
all_files_present = False
if all_files_present == True:
print " OK - All files in manifest found."
def ParseDir(dir_to_check):
if not os.path.isdir(dir_to_check):
print " OK - Skipping " + dir_to_check.replace("//", "/")
return
onlyfiles = [ f for f in listdir(dir_to_check) if isfile(join(dir_to_check,f)) ]
all_files_present = True
for file in onlyfiles:
if not file in open(sys.argv[1]).read():
# Check exception tags
exception_found = False
for idx, tag in enumerate(sys.argv):
if idx >= 3:
if file.startswith(tag):
exception_found = True
break
if exception_found == False:
print " WARN - " + dir_to_check.replace('//', '/') + ": " + str(file) + " found in project directory, but not in manifest file!"
all_files_present = False
if all_files_present == True:
print " OK - " + dir_to_check.replace('//', '/')
if sys.argv[1] is None:
print "Invalid parameters."
else:
print "==============================================================="
print " Checking " + sys.argv[2] + " project files..."
print "==============================================================="
print " Parsing manifest..."
ParseManifest()
print " Parsing project directories..."
ParseDir(".//readmes")
ParseDir(".//Interface//" + sys.argv[2])
ParseDir(".//Interface//exported//widgets//" + sys.argv[2])
ParseDir(".//Interface//Translations//")
ParseDir(".//meshes//" + sys.argv[2])
ParseDir(".//textures//" + sys.argv[2])
ParseDir(".//Scripts")
ParseDir(".//Scripts//Source")
ParseDir(".//SEQ")
ParseDir(".//sound//fx//" + sys.argv[2])