Enhanced code to delete derived files when the associated source is deleted.

Sat, 02 Jul 2011 14:22:58 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 02 Jul 2011 14:22:58 +0200
changeset 1157
31644008f9b2
parent 1155
4cbef040f07e
child 1158
33dce2093b6f

Enhanced code to delete derived files when the associated source is deleted.

Project/Project.py file | annotate | diff | comparison | revisions
diff -r 4cbef040f07e -r 31644008f9b2 Project/Project.py
--- a/Project/Project.py	Fri Jul 01 19:46:37 2011 +0200
+++ b/Project/Project.py	Sat Jul 02 14:22:58 2011 +0200
@@ -1721,11 +1721,15 @@
         """
         try:
             os.remove(os.path.join(self.ppath, fn))
-            dummy, ext = os.path.splitext(fn)
+            path, ext = os.path.splitext(fn)
             if ext == '.ui':
                 fn2 = os.path.join(self.ppath, '{0}.h'.format(fn))
                 if os.path.isfile(fn2):
                     os.remove(fn2)
+            for ext in ['.pyc', '.pyo']:
+                fn2 = path + ext
+                if os.path.isfile(fn2):
+                    os.remove(fn2)
         except EnvironmentError:
             E5MessageBox.critical(self.ui,
                 self.trUtf8("Delete file"),

eric ide

mercurial