2025-01-09 20:22:49 +01:00
|
|
|
import subprocess
|
|
|
|
import glob
|
|
|
|
from pathlib import Path
|
|
|
|
# Format script
|
|
|
|
|
|
|
|
def fmt_file(path):
|
|
|
|
if Path(path).is_dir():
|
|
|
|
return # Skip
|
|
|
|
try:
|
|
|
|
subprocess.run(['clang-format', '-i', path, '--style=Google'], check=True)
|
|
|
|
except subprocess.CalledProcessError as e:
|
|
|
|
print('Error for ' + Path(path).stem + ': ' + e)
|
|
|
|
|
|
|
|
def fmt_dir(path):
|
|
|
|
sources = glob.glob(path+'/*')
|
|
|
|
for file in sources:
|
|
|
|
fmt_file(file)
|
|
|
|
|
|
|
|
print('Formatting...')
|
|
|
|
fmt_dir('source/base')
|
|
|
|
fmt_dir('source/drivers')
|
|
|
|
fmt_dir('include')
|
|
|
|
fmt_dir('include/pd/base')
|
|
|
|
fmt_dir('include/pd/app')
|
|
|
|
fmt_dir('include/pd/drivers')
|
|
|
|
fmt_dir('include/pd/gfx')
|
|
|
|
|
2024-07-12 19:48:34 +02:00
|
|
|
print('Done')
|