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