]> git.donarmstrong.com Git - lilypond.git/commitdiff
Maintenance: whitespace-stripping script, thanks Marc!
authorGraham Percival <graham@percival-music.ca>
Mon, 21 Dec 2009 16:59:53 +0000 (16:59 +0000)
committerGraham Percival <graham@percival-music.ca>
Mon, 21 Dec 2009 17:02:23 +0000 (17:02 +0000)
scripts/auxiliar/strip-whitespace.py [new file with mode: 0755]

diff --git a/scripts/auxiliar/strip-whitespace.py b/scripts/auxiliar/strip-whitespace.py
new file mode 100755 (executable)
index 0000000..10da116
--- /dev/null
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+import sys
+
+for fname in sys.argv[1:]:
+  fd = open(fname,mode='U') # open in universal newline mode
+  lines = []
+  for line in fd.readlines():
+      lines.append( line.rstrip() )
+  fd.close()
+
+  fd = open(fname,mode='w')
+  fd.seek(0)
+  for line in lines:
+      fd.write(line+'\n')
+  fd.close()
+