[Commits] python.it commit r210 - admin/trunk/scripts
commit a svn.python.it
commit a svn.python.it
Gio 31 Ago 2006 20:09:43 CEST
Author: manlio
Date: Thu Aug 31 20:09:34 2006
New Revision: 210
Added:
admin/trunk/scripts/normalize.py (contents, props changed)
Log:
aggiunto nuovo script
Added: admin/trunk/scripts/normalize.py
==============================================================================
--- (empty file)
+++ admin/trunk/scripts/normalize.py Thu Aug 31 20:09:34 2006
@@ -0,0 +1,33 @@
+"""python.it administrative scripts.
+
+Normalize the newline ending of a file, using POSIX convention.
+
+$Id$
+
+THIS SOFTWARE IS UNDER MIT LICENSE.
+(C) 2006 Perillo Manlio (manlio.perillo a gmail.com)
+
+Read LICENSE file for more informations.
+
+TODO: check for non ascii characters
+"""
+
+
+import os
+import sys
+
+
+
+filename = sys.argv[1] + ".backup"
+os.rename(sys.argv[1], filename)
+
+
+fpin = file(filename)
+fpout = file(sys.argv[1], 'wb')
+
+# fix end of line (assuming we have universal newline support)
+for line in fpin:
+ fpout.write(line)
+
+
+
Maggiori informazioni sulla lista
Commits