diff -r 1843ef6e2656 -r ce77f0b1ee67 PluginManager/PluginInstallDialog.py --- a/PluginManager/PluginInstallDialog.py Mon Aug 12 22:21:53 2013 +0200 +++ b/PluginManager/PluginInstallDialog.py Sun Sep 08 19:04:07 2013 +0200 @@ -14,6 +14,7 @@ import shutil import zipfile import compileall +import glob try: # Py3 import urllib.parse as parse except (ImportError): @@ -299,6 +300,7 @@ internalPackages = [] needsRestart = False pyqtApi = 0 + doCompile = True for line in pluginSource.splitlines(): if line.startswith("packageName"): tokens = line.split("=") @@ -322,6 +324,10 @@ pyqtApi = int(tokens[1].strip()) except ValueError: pass + elif line.startswith("doNotCompile"): + tokens = line.split("=") + if tokens[1].strip() == "True": + doCompile = False elif line.startswith("# End-Of-Header"): break @@ -439,7 +445,9 @@ False # now compile the plugins - compileall.compile_dir(destination, quiet=True) + if doCompile: + compileall.compile_dir(os.path.join(destination, packageName), quiet=True) + compileall.compile_file(os.path.join(destination, pluginFileName), quiet=True) if not self.__external: # now load and activate the plugin @@ -507,6 +515,16 @@ if os.path.exists(fnamec): os.remove(fnamec) + pluginDirCache = os.path.join(os.path.dirname(pluginFile), "__pycache__") + if os.path.exists(pluginDirCache): + pluginFileName = os.path.splitext(os.path.basename(pluginFile))[0] + for fnameo in glob.glob( + os.path.join(pluginDirCache, "{0}*.pyo".format(pluginFileName))): + os.remove(fnameo) + for fnamec in glob.glob( + os.path.join(pluginDirCache, "{0}*.pyc".format(pluginFileName))): + os.remove(fnamec) + os.remove(pluginFile) except (IOError, OSError, os.error): # ignore some exceptions