11 |
11 |
12 import sys |
12 import sys |
13 import os |
13 import os |
14 import imp |
14 import imp |
15 import shutil |
15 import shutil |
|
16 import glob |
16 |
17 |
17 from PyQt4.QtCore import pyqtSlot, pyqtSignal |
18 from PyQt4.QtCore import pyqtSlot, pyqtSignal |
18 from PyQt4.QtGui import QWidget, QDialog, QDialogButtonBox, QVBoxLayout |
19 from PyQt4.QtGui import QWidget, QDialog, QDialogButtonBox, QVBoxLayout |
19 |
20 |
20 from E5Gui import E5MessageBox |
21 from E5Gui import E5MessageBox |
143 |
144 |
144 fnamec = "{0}c".format(pluginFile) |
145 fnamec = "{0}c".format(pluginFile) |
145 if os.path.exists(fnamec): |
146 if os.path.exists(fnamec): |
146 os.remove(fnamec) |
147 os.remove(fnamec) |
147 |
148 |
|
149 pluginDirCache = os.path.join(os.path.dirname(pluginFile), "__pycache__") |
|
150 if os.path.exists(pluginDirCache): |
|
151 pluginFileName = os.path.splitext(os.path.basename(pluginFile))[0] |
|
152 for fnameo in glob.glob( |
|
153 os.path.join(pluginDirCache, "{0}*.pyo".format(pluginFileName))): |
|
154 os.remove(fnameo) |
|
155 for fnamec in glob.glob( |
|
156 os.path.join(pluginDirCache, "{0}*.pyc".format(pluginFileName))): |
|
157 os.remove(fnamec) |
|
158 |
148 os.remove(pluginFile) |
159 os.remove(pluginFile) |
149 except OSError as err: |
160 except OSError as err: |
150 E5MessageBox.critical(self, |
161 E5MessageBox.critical(self, |
151 self.trUtf8("Plugin Uninstallation"), |
162 self.trUtf8("Plugin Uninstallation"), |
152 self.trUtf8("""<p>The plugin package <b>{0}</b> could not be""" |
163 self.trUtf8("""<p>The plugin package <b>{0}</b> could not be""" |