|
|
|
@ -93,13 +93,16 @@ def run_tests(): |
|
|
|
|
|
|
|
|
|
def check_file(fname): |
|
|
|
|
linenum = 0 |
|
|
|
|
for line in open(fname).readlines(): |
|
|
|
|
if '\t' in line: |
|
|
|
|
for line in open(fname, 'rb').readlines(): |
|
|
|
|
if b'\t' in line: |
|
|
|
|
print("File %s contains a literal tab on line %d. Only spaces are permitted." % (fname, linenum)) |
|
|
|
|
sys.exit(1) |
|
|
|
|
linenum += 1 |
|
|
|
|
if b'\r' in line: |
|
|
|
|
print("File %s contains DOS line ending on line %d. Only unix-style line endings are permitted." % (fname, linenum)) |
|
|
|
|
sys.exit(1) |
|
|
|
|
linenum += 1 |
|
|
|
|
|
|
|
|
|
def check_tabs(): |
|
|
|
|
def check_format(): |
|
|
|
|
for (root, dirs, files) in os.walk('.'): |
|
|
|
|
for file in files: |
|
|
|
|
if file.endswith('.py') or file.endswith('.build'): |
|
|
|
@ -110,5 +113,5 @@ if __name__ == '__main__': |
|
|
|
|
script_dir = os.path.split(__file__)[0] |
|
|
|
|
if script_dir != '': |
|
|
|
|
os.chdir(script_dir) |
|
|
|
|
check_tabs() |
|
|
|
|
check_format() |
|
|
|
|
run_tests() |
|
|
|
|