dabo Commit
Revision 2556
Date: 2006-12-16 14:27:50 -0800 (Sat, 16 Dec 2006)
Author: Ed

Changed:
U   trunk/dabo/lib/untabify.py

Log:
Made the creation of backup files optional. For the AppWizard, we don't need 
them.


Diff:
Modified: trunk/dabo/lib/untabify.py
===================================================================
--- trunk/dabo/lib/untabify.py  2006-12-16 15:50:42 UTC (rev 2555)
+++ trunk/dabo/lib/untabify.py  2006-12-16 22:27:50 UTC (rev 2556)
@@ -23,7 +23,7 @@
        for filename in args:
                process(filename, tabsize)
 
-def process(filename, tabsize):
+def process(filename, tabsize, saveBackup=True):
        try:
                f = open(filename)
                text = f.read()
@@ -34,19 +34,20 @@
        newtext = text.expandtabs(tabsize)
        if newtext == text:
                return
-       backup = filename + "~"
-       try:
-               os.unlink(backup)
-       except os.error:
-               pass
-       try:
-               os.rename(filename, backup)
-       except os.error:
-               pass
+       if saveBackup:
+               backup = filename + "~"
+               try:
+                       os.unlink(backup)
+               except os.error:
+                       pass
+               try:
+                       os.rename(filename, backup)
+               except os.error:
+                       pass
        f = open(filename, "w")
        f.write(newtext)
        f.close()
-       print filename
+#      print filename
 
 if __name__ == '__main__':
        main()




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev

Reply via email to