Sat, 02 Jul 2011 14:59:45 +0200
Enhanced the last change to cope with Python's __pycache__ directories (as of Python 3.2.0).
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 @@ -1726,10 +1726,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"),