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

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))