diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2013-03-31 00:22:22 +0100 |
---|---|---|
committer | Johannes Berg <johannes@sipsolutions.net> | 2013-03-31 00:22:55 +0100 |
commit | 29879860f4acced68c000fd30c5f0a87c1aa873e (patch) | |
tree | 36f8bd39794fcc84accef1639be49120ca311055 /gentree.py | |
parent | 6590e3d857c679060d46c269d4ef5bc26f44c20e (diff) |
split kconfig symbol list
The regular expression engine only supports a limited
number of groups, so split the kconfig symbol list
into chunks of 50 for the mangling.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Diffstat (limited to 'gentree.py')
-rwxr-xr-x | gentree.py | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -244,15 +244,18 @@ def main(): os.unlink(os.path.join(root, f)) # rewrite Makefile and source symbols - r = 'CONFIG_((' + '|'.join([s + '(_MODULE)?' for s in symbols]) + ')([^A-Za-z0-9_]|$))' - r = re.compile(r, re.MULTILINE) + regexes = [] + for some_symbols in [symbols[i:i + 50] for i in range(0, len(symbols), 50)]: + r = 'CONFIG_((' + '|'.join([s + '(_MODULE)?' for s in some_symbols]) + ')([^A-Za-z0-9_]|$))' + regexes.append(re.compile(r, re.MULTILINE)) for root, dirs, files in os.walk(args.outdir): # don't go into .git dir (possible debug thing) if '.git' in dirs: dirs.remove('.git') for f in files: data = open(os.path.join(root, f), 'r').read() - data = r.sub(r'CPTCFG_\1', data) + for r in regexes: + data = r.sub(r'CPTCFG_\1', data) fo = open(os.path.join(root, f), 'w') fo.write(data) fo.close() |