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

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

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 02 Jul 2011 14:22:58 +0200
branch
5_1_x
changeset 1159
43d3b178ae5b
parent 1156
48999111929c
child 1160
5e63e3cfc980

Enhanced code to delete derived files when the associated source is deleted.
(transplanted from 31644008f9b20e83580060e44a4313c201be7fb4)

Project/Project.py file | annotate | diff | comparison | revisions
diff -r 48999111929c -r 43d3b178ae5b 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
@@ -1720,11 +1720,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