Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authoramartin <olpc@localhost.localdomain>2007-01-31 06:34:42 (GMT)
committer amartin <olpc@localhost.localdomain>2007-01-31 06:34:42 (GMT)
commit7ef8344d8331781d3a7a3f516e3a33aaa389276b (patch)
treee891e280a36c11c2ce8546d5e2da3bc8f0e2adbb /scripts
parent46d07b755b7a53610f6b88a98a2e170410668ba3 (diff)
clean_trailing_whitespace.py
Diffstat (limited to 'scripts')
-rw-r--r--scripts/clean_trailing_whitespace.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/clean_trailing_whitespace.py b/scripts/clean_trailing_whitespace.py
new file mode 100644
index 0000000..13532b2
--- /dev/null
+++ b/scripts/clean_trailing_whitespace.py
@@ -0,0 +1,25 @@
+
+import sys
+import os
+import shutil
+
+fName = sys.argv[1]
+
+i = 0
+while os.path.exists( fName + ".bak%d" % i ): i += 1
+bakName = fName + ".bak%d" % i
+
+shutil.move( fName, bakName )
+
+r = open(bakName)
+w = open(fName, "w" )
+for line in r:
+ line = line[:-1]
+ while len(line) and (line[-1] == " " or line[-1] == " "):
+ line = line[:-1]
+ w.write(line+"\n")
+
+w.close()
+r.close()
+
+