summaryrefslogtreecommitdiff
path: root/contrib/scripts/removetrailingwhitespace.py.in
blob: 6a133ecd0bd002e0ddc00bc26f02374907d443ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!@PYTHONEXE@

import sys
import re

for fileName in sys.argv[1:]:
    f = open(fileName, 'r+')
    fileString = f.read()

    fileString = re.sub(r'[ ]+\n', r'\n', fileString)
    fileString = re.sub(r'\r', r'', fileString)
    f.seek(0)
    f.write(fileString)
    f.truncate(len(fileString))