PluginManager/PluginUninstallDialog.py

branch
5_3_x
changeset 2855
df823a1024fa
parent 2825
323d417d256b
child 3163
9f50365a0870
equal deleted inserted replaced
2852:1d360120e928 2855:df823a1024fa
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"""

eric ide

mercurial