Files
mcmartin d0dcf67ac6 Resource information is now centralized in resources.csv.
The old scripts that trolled content/ and src/ for information
have been retired, and the new script reads the CSV file and
generates the resource files directly.

Future changes to the resource indices or content should be
done by modifying resources.csv and regenerating the data.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2925 8092fc87-c524-0410-9efc-e669fe64eaf9
2008-02-24 22:06:03 +00:00

43 lines
1.2 KiB
Python

#!/usr/bin/python
import sys
import os
import os.path
import re
def collect_extension(d, ext):
result = []
for (dirpath, dirnames, filenames) in os.walk(d):
for l in [f for f in filenames if f.endswith(ext)]:
result.append(os.path.join(dirpath, l))
return result
def collect_res_headers(d, pattern="i.*\\.h$"):
result = []
regex = re.compile(pattern)
for (dirpath, dirnames, filenames) in os.walk(d):
for l in [f for f in filenames if regex.match(f) != None]:
result.append(os.path.join(dirpath, l))
return result
def read_list(f):
result = []
for line in file(f):
parsed = line.split()
if len(parsed) == 4:
result.append(((int(parsed[0]), int(parsed[1]), int(parsed[2])),
parsed[3]))
return result
def read_header(f):
result = []
for line in file(f):
line = line.strip()
if line.startswith("#define"):
parsed = [x.strip() for x in line.split()]
if len(parsed) == 3 and parsed[2].startswith('0') and parsed[2].endswith('L'):
result.append((parsed[1], parsed[2]))
return result
if __name__ == "__main__":
print "This is a library and isn't intended to be run directly."