1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-23 03:02:30 +01:00
ScreenPlay/Tools/format-cmake.py
Elias Steurer 2311cdaccb Format file with latest python 3.9
Apparently my python 3.6 install an old cmakelang
2020-10-29 20:06:13 +01:00

18 lines
572 B
Python

import fnmatch
import os
import sys
import subprocess
for root, dirnames, filenames in os.walk('..'):
for filename in fnmatch.filter(filenames, 'CMakeLists.txt'):
print("cmake-format -c ../.cmake-format.py -i " + root + "/" + filename)
os.system("cmake-format -c ../.cmake-format.py -i %s" % ((root + "/" + filename)))
# Check if all files are formatter
output = subprocess.check_output("git diff", shell=True)
if output:
print("Git diff is not empty. This means your CMakeLists.txt file was not formatted!")
#print(output)
sys.exit(1)