diff options
Diffstat (limited to 'tools/migrate-1')
| -rw-r--r-- | tools/migrate-1/migrate-cmake.py | 26 | ||||
| -rw-r--r-- | tools/migrate-1/migrate-files.py | 43 |
2 files changed, 0 insertions, 69 deletions
diff --git a/tools/migrate-1/migrate-cmake.py b/tools/migrate-1/migrate-cmake.py deleted file mode 100644 index b90bd2e9..00000000 --- a/tools/migrate-1/migrate-cmake.py +++ /dev/null @@ -1,26 +0,0 @@ -import re -from pathlib import Path - -regex = re.compile(r'\s*(.*\/)*(.*)(\.[hc]pp)$') - -def xstr(s): - if s is None: - return '' - return str(s) - -for p in Path('./src').rglob('CMakeLists.txt'): - text = '' - with p.open(mode='r', encoding='utf-8') as f: - for line in f.readlines(): - m = regex.match(line) - if m: - t = m.group(2) - t = ''.join(([i.capitalize() for i in t.split('_')])) - t = '\t{}{}{}\n'.format(xstr(m.group(1)), t, m.group(3)) - text += t - else: - text += line - with p.open(mode='w', encoding='utf-8') as f: - f.write(text) - - diff --git a/tools/migrate-1/migrate-files.py b/tools/migrate-1/migrate-files.py deleted file mode 100644 index 8ea8bde6..00000000 --- a/tools/migrate-1/migrate-files.py +++ /dev/null @@ -1,43 +0,0 @@ -import re -import pathlib - -regex = re.compile(r'#include\s+"(.*\/)*(.*)"') - - -def xstr(s): - if s is None: - return '' - return str(s) - - -def migrate_includes(path: pathlib.Path): - text = '' - with path.open(mode='r', encoding='utf-8') as f: - for line in f.readlines(): - m = regex.match(line) - if m: - t = m.group(2) - t = ''.join(([i.capitalize() for i in t.split('_')])) - t = '#include "{}{}"\n'.format(xstr(m.group(1)), t) - text += t - else: - text += line - - with path.open(mode='w', encoding='utf-8') as f: - f.write(text) - - -for p in pathlib.Path('./src').rglob('*.cpp'): - migrate_includes(p) - p.rename(p.parent.joinpath( - ''.join([i.capitalize() for i in p.name.split('_')]))) - -for p in pathlib.Path('./src').rglob('*.hpp'): - migrate_includes(p) - p.rename(p.parent.joinpath( - ''.join([i.capitalize() for i in p.name.split('_')]))) - -for p in pathlib.Path('./include/cru').rglob('*.hpp'): - migrate_includes(p) - p.rename(p.parent.joinpath( - ''.join([i.capitalize() for i in p.name.split('_')]))) |
