diff options
| author | 2022-06-15 06:21:56 +1000 | |
|---|---|---|
| committer | 2022-06-15 06:21:56 +1000 | |
| commit | b911bd29a5ad76a7e5c3c4a632470dd5652cc5f6 (patch) | |
| tree | bae7e42fa5c59f28745f383c566cdfa29f98d3aa /src/tools | |
| parent | d8854e4e5563265ba12c50cfcf9fb97cd37a2d40 (diff) | |
Cleaned up a few more legacy callbacks.
Diffstat (limited to 'src/tools')
| -rwxr-xr-x | src/tools/reorganize.py | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/tools/reorganize.py b/src/tools/reorganize.py index c013dc4368a..e755ff8a86e 100755 --- a/src/tools/reorganize.py +++ b/src/tools/reorganize.py @@ -99,37 +99,37 @@ def update_projects(root, renaming, *scripts): def update_driver_list(fname, renaming, projectmap): with open(fname, 'r', encoding='utf-8') as infile: lines = infile.readlines() - with open(fname, 'w', encoding='utf-8') as outfile: - for l in lines: - ls = l.rstrip('\r\n') - match = re.match('(.*@source:)([-_0-9a-z]+\\.cpp)\\b(\s*)(.*)', ls) - if match: - f = 'drivers/' + match.group(2) - r = projectmap[f] + '/' + renaming.get(f, match.group(2)) - if match.group(3): - w = len(match.group(2)) + len(match.group(3)) - if len(r) < w: - r = r + (' ' * (w - len(r))) - else: - r = r + ' ' - print(match.group(1) + r + match.group(4), file=outfile) - else: - print(ls, file=outfile) + with open(fname, 'w', encoding='utf-8') as outfile: + for l in lines: + ls = l.rstrip('\r\n') + match = re.match('(.*@source:)([-_0-9a-z]+\\.cpp)\\b(\s*)(.*)', ls) + if match: + f = 'drivers/' + match.group(2) + r = projectmap[f] + '/' + renaming.get(f, match.group(2)) + if match.group(3): + w = len(match.group(2)) + len(match.group(3)) + if len(r) < w: + r = r + (' ' * (w - len(r))) + else: + r = r + ' ' + print(match.group(1) + r + match.group(4), file=outfile) + else: + print(ls, file=outfile) def update_driver_filter(fname, renaming, projectmap): with open(fname, 'r', encoding='utf-8') as infile: lines = infile.readlines() - with open(fname, 'w', encoding='utf-8') as outfile: - for l in lines: - ls = l.rstrip('\r\n') - match = re.match('(.*)(?<![-_0-9a-z])([-_0-9a-z]+\\.cpp)\\b(.*)', ls) - if match: - f = 'drivers/' + match.group(2) - b = renaming.get(f, match.group(2)) - print(match.group(1) + projectmap[f] + '/' + b + match.group(3), file=outfile) - else: - print(ls, file=outfile) + with open(fname, 'w', encoding='utf-8') as outfile: + for l in lines: + ls = l.rstrip('\r\n') + match = re.match('(.*)(?<![-_0-9a-z])([-_0-9a-z]+\\.cpp)\\b(.*)', ls) + if match: + f = 'drivers/' + match.group(2) + b = renaming.get(f, match.group(2)) + print(match.group(1) + projectmap[f] + '/' + b + match.group(3), file=outfile) + else: + print(ls, file=outfile) def relocate_source(root, filename, destbase, renaming, projectmap): |
