0
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
1 #
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
2 # Build
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
3 #
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
4
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
5 import Map
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
6 import os
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
7 import sys
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
8
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
9 if __name__ == '__main__':
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
10 path_root = os.path.dirname(sys.argv[0])
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
11 path_assets = os.path.abspath(os.path.join(path_root, '..', 'Assets', 'Maps'))
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
12 path_build = os.path.abspath(os.path.join(path_root, '..', 'Data', 'Maps'))
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
13
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
14 if os.path.isdir(path_assets):
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
15 for filename in os.listdir(path_assets):
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
16 if not filename.endswith('.def'):
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
17 continue
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
18
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
19 definition = Map.ReadDefinition(os.path.join(path_assets, filename))
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
20 if not definition:
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
21 continue
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
22
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
23 output = os.path.join(path_build, os.path.splitext(filename)[0] + '.map')
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
24 folder = os.path.dirname(output)
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
25
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
26 if not os.path.isdir(folder):
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
27 os.makedirs(folder)
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
28
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
29 print 'Building %s from %s' % (os.path.basename(output), os.path.basename(filename))
|
koryspansel <koryspansel@bendbroadband.com>
parents:
diff
changeset
|
30 definition.Write(output)
|