From e86a46545e23ad824d7013c3c57bd83a52ade9af Mon Sep 17 00:00:00 2001 From: Tobias Markmann Date: Tue, 19 May 2015 10:45:22 +0200 Subject: Enforce tab-only indentation in Python and SCons files This also converts CheckTabs.py script to tab indentation. Test-Information: Ran the script over all files in our repo and it detected space and mixed indented Python files. Change-Id: Ifed86d64c8e87ed55e85ef4d35157e312b937291 diff --git a/BuildTools/CheckTabs.py b/BuildTools/CheckTabs.py index e007a68..e2029b0 100755 --- a/BuildTools/CheckTabs.py +++ b/BuildTools/CheckTabs.py @@ -5,27 +5,27 @@ import os, sys foundExpandedTabs = False filename = sys.argv[1] -if (filename.endswith(".cpp") or filename.endswith(".h")) and not "3rdParty" in filename : - file = open(filename, "r") - contents = [] - contentsChanged = False - for line in file.readlines() : - newline = "" - previousChar = None - pastInitialSpace = False - for char in line : - if not pastInitialSpace : - if char == ' ' and previousChar == ' ' : - contentsChanged = True - previousChar = '\t' - continue - pastInitialSpace = (char != ' ') - if previousChar : - newline += previousChar - previousChar = char - if previousChar : - newline += previousChar - contents.append(newline) - file.close() - if contentsChanged : - sys.exit(-1) +if (filename.endswith(".cpp") or filename.endswith(".h") or filename.endswith(".py") or filename.endswith("SConscript") or filename.endswith("SConscript.boot") or filename.endswith("SConstruct")) and not "3rdParty" in filename : + file = open(filename, "r") + contents = [] + contentsChanged = False + for line in file.readlines() : + newline = "" + previousChar = None + pastInitialSpace = False + for char in line : + if not pastInitialSpace : + if char == ' ' and previousChar == ' ' : + contentsChanged = True + previousChar = '\t' + continue + pastInitialSpace = (char != ' ') + if previousChar : + newline += previousChar + previousChar = char + if previousChar : + newline += previousChar + contents.append(newline) + file.close() + if contentsChanged : + sys.exit(-1) -- cgit v0.10.2-6-g49f6