Enhanced the last change to cope with Python's __pycache__ directories (as of Python 3.2.0). 5_1_x

Sat, 02 Jul 2011 14:59:45 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 02 Jul 2011 14:59:45 +0200
branch
5_1_x
changeset 1160
5e63e3cfc980
parent 1159
43d3b178ae5b
child 1164
3fe5465a73c5
child 1185
d47de1d09f7c

Enhanced the last change to cope with Python's __pycache__ directories (as of Python 3.2.0).
(transplanted from 33dce2093b6fce3ef334b9d3ca329a88764729a7)

Project/Project.py file | annotate | diff | comparison | revisions
--- a/Project/Project.py	Sat Jul 02 14:22:58 2011 +0200
+++ b/Project/Project.py	Sat Jul 02 14:59:45 2011 +0200
@@ -1725,10 +1725,15 @@
                 fn2 = os.path.join(self.ppath, '{0}.h'.format(fn))
                 if os.path.isfile(fn2):
                     os.remove(fn2)
+            head, tail = os.path.split(path)
             for ext in ['.pyc', '.pyo']:
-                fn2 = path + ext
+                fn2 = os.path.join(self.ppath, path + ext)
                 if os.path.isfile(fn2):
                     os.remove(fn2)
+                pat = os.path.join(
+                    self.ppath, head, "__pycache__", "{0}.*{1}".format(tail, ext))
+                for f in glob.glob(pat):
+                    os.remove(f)
         except EnvironmentError:
             E5MessageBox.critical(self.ui,
                 self.trUtf8("Delete file"),

eric ide

mercurial