Wed, 05 May 2021 19:59:47 +0200
Started preparing the plugin manager to install plug-in dependecies.
eric6/PluginManager/PluginInstallDialog.py | file | annotate | diff | comparison | revisions | |
eric6/PluginManager/PluginManager.py | file | annotate | diff | comparison | revisions |
--- a/eric6/PluginManager/PluginInstallDialog.py Wed May 05 18:17:24 2021 +0200 +++ b/eric6/PluginManager/PluginInstallDialog.py Wed May 05 19:59:47 2021 +0200 @@ -471,28 +471,12 @@ with open(outname, "w", encoding="utf-8") as f: f.write(pluginSource) self.__installedFiles.append(outname) - except os.error as why: - self.__rollback() - return ( - False, - self.tr( - "Error installing plugin. Reason: {0}").format(str(why)), - False - ) except OSError as why: self.__rollback() return ( False, - self.tr( - "Error installing plugin. Reason: {0}").format(str(why)), - False - ) - except OSError as why: - self.__rollback() - return ( - False, - self.tr( - "Error installing plugin. Reason: {0}").format(str(why)), + self.tr("Error installing plugin. Reason: {0}") + .format(str(why)), False ) except Exception:
--- a/eric6/PluginManager/PluginManager.py Wed May 05 18:17:24 2021 +0200 +++ b/eric6/PluginManager/PluginManager.py Wed May 05 19:59:47 2021 +0200 @@ -422,6 +422,9 @@ self.__onDemandInactiveModules[name] = module module.eric6PluginModuleName = name module.eric6PluginModuleFilename = fname + if hasattr(module, "installDependencies"): + # ask the module to install its dependencies + module.installDependencies(self.pipInstall) self.__modulesCount += 1 if reload_: importlib.reload(module) @@ -1416,6 +1419,22 @@ hasattr(module, "clearPrivateData") ): module.clearPrivateData() + + ######################################################################## + ## Methods to install a plug-in module dependency via pip + ######################################################################## + + def pipInstall(self, packageName): + """ + Public method to install the given package via pip. + + @param packageName name of the package to be installed + @type str + @return flag indicating a successful installation + @rtype bool + """ + # TODO: implement this + return False # # eflag: noqa = M801