297 pluginSource = Utilities.decode(zip.read(pluginFileName))[0] |
298 pluginSource = Utilities.decode(zip.read(pluginFileName))[0] |
298 packageName = "" |
299 packageName = "" |
299 internalPackages = [] |
300 internalPackages = [] |
300 needsRestart = False |
301 needsRestart = False |
301 pyqtApi = 0 |
302 pyqtApi = 0 |
|
303 doCompile = True |
302 for line in pluginSource.splitlines(): |
304 for line in pluginSource.splitlines(): |
303 if line.startswith("packageName"): |
305 if line.startswith("packageName"): |
304 tokens = line.split("=") |
306 tokens = line.split("=") |
305 if tokens[0].strip() == "packageName" and \ |
307 if tokens[0].strip() == "packageName" and \ |
306 tokens[1].strip()[1:-1] != "__core__": |
308 tokens[1].strip()[1:-1] != "__core__": |
437 return False, \ |
443 return False, \ |
438 self.trUtf8("Unspecific exception installing plugin."), \ |
444 self.trUtf8("Unspecific exception installing plugin."), \ |
439 False |
445 False |
440 |
446 |
441 # now compile the plugins |
447 # now compile the plugins |
442 compileall.compile_dir(destination, quiet=True) |
448 if doCompile: |
|
449 compileall.compile_dir(os.path.join(destination, packageName), quiet=True) |
|
450 compileall.compile_file(os.path.join(destination, pluginFileName), quiet=True) |
443 |
451 |
444 if not self.__external: |
452 if not self.__external: |
445 # now load and activate the plugin |
453 # now load and activate the plugin |
446 self.__pluginManager.loadPlugin(installedPluginName, destination, reload_) |
454 self.__pluginManager.loadPlugin(installedPluginName, destination, reload_) |
447 if activatePlugin: |
455 if activatePlugin: |
505 |
513 |
506 fnamec = "{0}c".format(pluginFile) |
514 fnamec = "{0}c".format(pluginFile) |
507 if os.path.exists(fnamec): |
515 if os.path.exists(fnamec): |
508 os.remove(fnamec) |
516 os.remove(fnamec) |
509 |
517 |
|
518 pluginDirCache = os.path.join(os.path.dirname(pluginFile), "__pycache__") |
|
519 if os.path.exists(pluginDirCache): |
|
520 pluginFileName = os.path.splitext(os.path.basename(pluginFile))[0] |
|
521 for fnameo in glob.glob( |
|
522 os.path.join(pluginDirCache, "{0}*.pyo".format(pluginFileName))): |
|
523 os.remove(fnameo) |
|
524 for fnamec in glob.glob( |
|
525 os.path.join(pluginDirCache, "{0}*.pyc".format(pluginFileName))): |
|
526 os.remove(fnamec) |
|
527 |
510 os.remove(pluginFile) |
528 os.remove(pluginFile) |
511 except (IOError, OSError, os.error): |
529 except (IOError, OSError, os.error): |
512 # ignore some exceptions |
530 # ignore some exceptions |
513 pass |
531 pass |
514 |
532 |