def addPlugin(self, plugins):
   """ add a plugin (first from given) to the mPlugins dict """
   key = plugins.keys()[0]
   plugin = plugins[key]
   plugin["version_avail"] = normalizeVersion(plugin["version_avail"])
   plugin["version_inst"] = normalizeVersion(plugin["version_inst"])
   if not self.mPlugins.has_key(key) or compareVersions(self.mPlugins[key]["version_avail"],plugin["version_avail"]) == 2:
     self.mPlugins[key] = plugin # add the plugin if not present yet or if is newer than existing one
  def getInstalledPlugin(self, key, readOnly, testLoad=True):
    """ get the metadata of an installed plugin """
    def metadataParser(fct):
        """ plugin metadata parser reimplemented from qgis.utils
            for better control on wchich module is examined
            in case there is an installed plugin masking a core one """
        metadataFile = os.path.join(path, 'metadata.txt')
        if not os.path.exists(metadataFile):
          return "" # plugin has no metadata.txt file
        cp = ConfigParser.ConfigParser()
        try:
          cp.readfp(codecs.open(metadataFile, "r", "utf8"))
          return cp.get('general', fct)
        except:
          return ""

    def pluginMetadata(fct):
        """ calls metadataParser for current l10n.
            If failed, fallbacks to the standard metadata """
        locale = QLocale.system().name()
        if locale and fct in translatableAttributes:
          value = metadataParser( "%s[%s]" % (fct, locale ) )
          if value: return value
          value = metadataParser( "%s[%s]" % (fct, locale.split("_")[0] ) )
          if value: return value
        return metadataParser( fct )

    if readOnly:
      path = QDir.cleanPath( QgsApplication.pkgDataPath() ) + "/python/plugins/" + key
    else:
      path = QDir.cleanPath( QgsApplication.qgisSettingsDirPath() ) + "/python/plugins/" + key

    if not QDir(path).exists():
      return

    plugin = dict()
    error = ""
    errorDetails = ""

    version = normalizeVersion( pluginMetadata("version") )
    if version:
      qgisMinimumVersion = pluginMetadata("qgisMinimumVersion").strip()
      if not qgisMinimumVersion: qgisMinimumVersion = "0"
      qgisMaximumVersion = pluginMetadata("qgisMaximumVersion").strip()
      if not qgisMaximumVersion: qgisMaximumVersion = qgisMinimumVersion[0] + ".99"
      #if compatible, add the plugin to the list
      if not isCompatible(QGis.QGIS_VERSION, qgisMinimumVersion, qgisMaximumVersion):
        error = "incompatible"
        errorDetails = "%s - %s" % (qgisMinimumVersion, qgisMaximumVersion)
      elif testLoad:
        # only testLoad if compatible version
        try:
          exec "import %s" % key in globals(), locals()
          exec "reload (%s)" % key in globals(), locals()
          exec "%s.classFactory(iface)" % key in globals(), locals()
        except Exception, error:
          error = unicode(error.args[0])
        except SystemExit, error:
          error = QCoreApplication.translate("QgsPluginInstaller", "The plugin exited with error status: {0}").format(error.args[0])
        except:
Example #3
0
  def getInstalledPlugin(self, key, path, readOnly, testLoad=True):
    """ get the metadata of an installed plugin """
    def metadataParser(fct):
        """ plugin metadata parser reimplemented from qgis.utils
            for better control on wchich module is examined
            in case there is an installed plugin masking a core one """
        metadataFile = os.path.join(path, 'metadata.txt')
        if not os.path.exists(metadataFile):
          return "" # plugin has no metadata.txt file
        cp = ConfigParser.ConfigParser()
        try:
          cp.readfp(codecs.open(metadataFile, "r", "utf8"))
          return cp.get('general', fct)
        except:
          return ""

    def pluginMetadata(fct):
        """ calls metadataParser for current l10n.
            If failed, fallbacks to the standard metadata """
        locale = QLocale.system().name()
        if locale and fct in translatableAttributes:
          value = metadataParser( "%s[%s]" % (fct, locale ) )
          if value: return value
          value = metadataParser( "%s[%s]" % (fct, locale.split("_")[0] ) )
          if value: return value
        return metadataParser( fct )

    if not QDir(path).exists():
      return

    plugin = dict()
    error = ""
    errorDetails = ""

    version = normalizeVersion( pluginMetadata("version") )
    if version:
      qgisMinimumVersion = pluginMetadata("qgisMinimumVersion").strip()
      if not qgisMinimumVersion: qgisMinimumVersion = "0"
      qgisMaximumVersion = pluginMetadata("qgisMaximumVersion").strip()
      if not qgisMaximumVersion: qgisMaximumVersion = qgisMinimumVersion[0] + ".99"
      #if compatible, add the plugin to the list
      if not isCompatible(QGis.QGIS_VERSION, qgisMinimumVersion, qgisMaximumVersion):
        error = "incompatible"
        errorDetails = "%s - %s" % (qgisMinimumVersion, qgisMaximumVersion)
      elif testLoad:
        # only testLoad if compatible version
        try:
          exec "import %s" % key in globals(), locals()
          exec "reload (%s)" % key in globals(), locals()
          exec "%s.classFactory(iface)" % key in globals(), locals()
        except Exception, error:
          error = unicode(error.args[0])
        except SystemExit, error:
          error = QCoreApplication.translate("QgsPluginInstaller", "The plugin exited with error status: {0}").format(error.args[0])
        except:
    def getInstalledPlugin(self, key, readOnly, testLoad=True):
        """ get the metadata of an installed plugin """
        def pluginMetadata(fct):
            """ plugin metadata parser reimplemented from qgis.utils
            for better control on wchich module is examined
            in case there is an installed plugin masking a core one """
            metadataFile = os.path.join(path, 'metadata.txt')
            if not os.path.exists(metadataFile):
                return ""  # plugin has no metadata.txt file
            cp = ConfigParser.ConfigParser()
            try:
                cp.readfp(codecs.open(metadataFile, "r", "utf8"))
                return cp.get('general', fct)
            except:
                return ""

        if readOnly:
            path = QDir.cleanPath(
                QgsApplication.pkgDataPath()) + "/python/plugins/" + key
        else:
            path = QDir.cleanPath(QgsApplication.qgisSettingsDirPath()
                                  ) + "/python/plugins/" + key

        if not QDir(path).exists():
            return

        plugin = dict()
        error = ""
        errorDetails = ""

        version = normalizeVersion(pluginMetadata("version"))
        if version:
            qgisMinimumVersion = pluginMetadata("qgisMinimumVersion").strip()
            if not qgisMinimumVersion: qgisMinimumVersion = "0"
            qgisMaximumVersion = pluginMetadata("qgisMaximumVersion").strip()
            if not qgisMaximumVersion:
                qgisMaximumVersion = qgisMinimumVersion[0] + ".99"
            #if compatible, add the plugin to the list
            if not isCompatible(QGis.QGIS_VERSION, qgisMinimumVersion,
                                qgisMaximumVersion):
                error = "incompatible"
                errorDetails = "%s - %s" % (qgisMinimumVersion,
                                            qgisMaximumVersion)

            if testLoad:
                try:
                    exec "import %s" % key in globals(), locals()
                    exec "reload (%s)" % key in globals(), locals()
                    exec "%s.classFactory(iface)" % key in globals(), locals()
                except Exception, error:
                    error = unicode(error.args[0])
  def getInstalledPlugin(self, key, readOnly, testLoad=True):
    """ get the metadata of an installed plugin """
    def pluginMetadata(fct):
        """ plugin metadata parser reimplemented from qgis.utils
            for better control on wchich module is examined
            in case there is an installed plugin masking a core one """
        metadataFile = os.path.join(path, 'metadata.txt')
        if not os.path.exists(metadataFile):
          return "" # plugin has no metadata.txt file
        cp = ConfigParser.ConfigParser()
        try:
          cp.readfp(codecs.open(metadataFile, "r", "utf8"))
          return cp.get('general', fct)
        except:
          return ""

    if readOnly:
      path = QDir.cleanPath( QgsApplication.pkgDataPath() ) + "/python/plugins/" + key
    else:
      path = QDir.cleanPath( QgsApplication.qgisSettingsDirPath() ) + "/python/plugins/" + key

    if not QDir(path).exists():
      return

    plugin = dict()
    error = ""
    errorDetails = ""

    version = normalizeVersion( pluginMetadata("version") )
    if version:
      qgisMinimumVersion = pluginMetadata("qgisMinimumVersion").strip()
      if not qgisMinimumVersion: qgisMinimumVersion = "0"
      qgisMaximumVersion = pluginMetadata("qgisMaximumVersion").strip()
      if not qgisMaximumVersion: qgisMaximumVersion = qgisMinimumVersion[0] + ".99"
      #if compatible, add the plugin to the list
      if not isCompatible(QGis.QGIS_VERSION, qgisMinimumVersion, qgisMaximumVersion):
        error = "incompatible"
        errorDetails = "%s - %s" % (qgisMinimumVersion, qgisMaximumVersion)

      if testLoad:
        try:
          exec "import %s" % key in globals(), locals()
          exec "reload (%s)" % key in globals(), locals()
          exec "%s.classFactory(iface)" % key in globals(), locals()
        except Exception, error:
          error = unicode(error.args[0])
Example #6
0
class Plugins(QObject):
    """ A dict-like class for handling plugins data """

    # ----------------------------------------- #
    def __init__(self):
        QObject.__init__(self)
        self.mPlugins = {}  # the dict of plugins (dicts)
        self.repoCache = {}  # the dict of lists of plugins (dicts)
        self.localCache = {}  # the dict of plugins (dicts)
        self.obsoletePlugins = [
        ]  # the list of outdated 'user' plugins masking newer 'system' ones

    # ----------------------------------------- #
    def all(self):
        """ return all plugins """
        return self.mPlugins

    # ----------------------------------------- #
    def allUpgradeable(self):
        """ return all upgradeable plugins """
        result = {}
        for i in self.mPlugins:
            if self.mPlugins[i]["status"] == "upgradeable":
                result[i] = self.mPlugins[i]
        return result

    # ----------------------------------------- #
    def keyByUrl(self, name):
        """ return plugin key by given url """
        plugins = [
            i for i in self.mPlugins
            if self.mPlugins[i]["download_url"] == name
        ]
        if plugins:
            return plugins[0]
        return None

    # ----------------------------------------- #
    def clearRepoCache(self):
        """ clears the repo cache before re-fetching repositories """
        self.repoCache = {}

    # ----------------------------------------- #
    def addFromRepository(self, plugin):
        """ add given plugin to the repoCache """
        repo = plugin["zip_repository"]
        try:
            self.repoCache[repo] += [plugin]
        except:
            self.repoCache[repo] = [plugin]

    # ----------------------------------------- #
    def removeInstalledPlugin(self, key):
        """ remove given plugin from the localCache """
        if key in self.localCache:
            del self.localCache[key]

    # ----------------------------------------- #
    def removeRepository(self, repo):
        """ remove whole repository from the repoCache """
        if repo in self.repoCache:
            del self.repoCache[repo]

    # ----------------------------------------- #
    def getInstalledPlugin(self, key, path, readOnly, testLoad=True):
        """ get the metadata of an installed plugin """
        def metadataParser(fct):
            """ plugin metadata parser reimplemented from qgis.utils
            for better control on wchich module is examined
            in case there is an installed plugin masking a core one """
            global errorDetails
            cp = ConfigParser.ConfigParser()
            try:
                cp.readfp(codecs.open(metadataFile, "r", "utf8"))
                return cp.get('general', fct)
            except Exception, e:
                if not errorDetails:
                    errorDetails = e.args[0]  # set to the first problem
                return ""

        def pluginMetadata(fct):
            """ calls metadataParser for current l10n.
            If failed, fallbacks to the standard metadata """
            locale = QLocale.system().name()
            if locale and fct in translatableAttributes:
                value = metadataParser("%s[%s]" % (fct, locale))
                if value: return value
                value = metadataParser("%s[%s]" % (fct, locale.split("_")[0]))
                if value: return value
            return metadataParser(fct)

        if not QDir(path).exists():
            return

        global errorDetails  # to communicate with the metadataParser fn
        plugin = dict()
        error = ""
        errorDetails = ""
        version = None

        metadataFile = os.path.join(path, 'metadata.txt')
        if os.path.exists(metadataFile):
            version = normalizeVersion(pluginMetadata("version"))

        if version:
            qgisMinimumVersion = pluginMetadata("qgisMinimumVersion").strip()
            if not qgisMinimumVersion: qgisMinimumVersion = "0"
            qgisMaximumVersion = pluginMetadata("qgisMaximumVersion").strip()
            if not qgisMaximumVersion:
                qgisMaximumVersion = qgisMinimumVersion[0] + ".99"
            #if compatible, add the plugin to the list
            if not isCompatible(QGis.QGIS_VERSION, qgisMinimumVersion,
                                qgisMaximumVersion):
                error = "incompatible"
                errorDetails = "%s - %s" % (qgisMinimumVersion,
                                            qgisMaximumVersion)
            elif testLoad:
                # only testLoad if compatible version
                try:
                    pkg = __import__(key)
                    reload(pkg)
                    pkg.classFactory(iface)
                except Exception, e:
                    error = "broken"
                    errorDetails = unicode(e.args[0])
                except SystemExit, e:
                    error = "broken"
                    errorDetails = QCoreApplication.translate(
                        "QgsPluginInstaller",
                        "The plugin exited with error status: {0}").format(
                            e.args[0])
                except:
Example #7
0
class Plugins(QObject):
    """ A dict-like class for handling plugins data """

    # ----------------------------------------- #
    def __init__(self):
        QObject.__init__(self)
        self.mPlugins = {}  # the dict of plugins (dicts)
        self.repoCache = {}  # the dict of lists of plugins (dicts)
        self.localCache = {}  # the dict of plugins (dicts)
        self.obsoletePlugins = [
        ]  # the list of outdated 'user' plugins masking newer 'system' ones

    # ----------------------------------------- #
    def all(self):
        """ return all plugins """
        return self.mPlugins

    # ----------------------------------------- #
    def keyByUrl(self, name):
        """ return plugin key by given url """
        plugins = [i for i in self.mPlugins if self.mPlugins[i]["url"] == name]
        if plugins:
            return plugins[0]
        return None

    # ----------------------------------------- #
    def addInstalled(self, plugin):
        """ add given plugin to the localCache """
        key = plugin["localdir"]
        self.localCache[key] = plugin

    # ----------------------------------------- #
    def addFromRepository(self, plugin):
        """ add given plugin to the repoCache """
        repo = plugin["repository"]
        try:
            self.repoCache[repo] += [plugin]
        except:
            self.repoCache[repo] = [plugin]

    # ----------------------------------------- #
    def removeInstalledPlugin(self, key):
        """ remove given plugin from the localCache """
        if self.localCache.has_key(key):
            del self.localCache[key]

    # ----------------------------------------- #
    def removeRepository(self, repo):
        """ remove whole repository from the repoCache """
        if self.repoCache.has_key(repo):
            del self.repoCache[repo]

    # ----------------------------------------- #
    def getInstalledPlugin(self, key, readOnly, testLoad=False):
        """ get the metadata of an installed plugin """
        if readOnly:
            path = QgsApplication.pkgDataPath()
        else:
            path = QgsApplication.qgisSettingsDirPath()
        path = QDir.cleanPath(path) + "/python/plugins/" + key
        if not QDir(path).exists():
            return
        nam = ""
        ver = ""
        desc = ""
        auth = ""
        homepage = ""
        error = ""
        errorDetails = ""
        try:
            exec("import %s" % key)
            exec("reload (%s)" % key)
            try:
                exec("nam = %s.name()" % key)
            except:
                pass
            try:
                exec("ver = %s.version()" % key)
            except:
                pass
            try:
                exec("desc = %s.description()" % key)
            except:
                pass
            try:
                exec("auth = %s.authorName()" % key)
            except:
                pass
            try:
                exec("homepage = %s.homepage()" % key)
            except:
                pass
            try:
                exec("qgisMinimumVersion = %s.qgisMinimumVersion()" % key)
                if compareVersions(QGIS_VER, qgisMinimumVersion) == 2:
                    error = "incompatible"
                    errorDetails = qgisMinimumVersion
            except:
                pass
            if testLoad:
                try:
                    exec("%s.classFactory(iface)" % key)
                except Exception, error:
                    error = unicode(error.args[0])
        except Exception, error:
            error = unicode(error.args[0])

        if not nam:
            nam = key
        if error[:16] == "No module named ":
            mona = error.replace("No module named ", "")
            if mona != key:
                error = "dependent"
                errorDetails = mona
        if not error in ["", "dependent", "incompatible"]:
            errorDetails = error
            error = "broken"

        plugin = {
            "name": nam,
            "version_inst": normalizeVersion(ver),
            "version_avail": "",
            "desc_local": desc,
            "desc_repo": "",
            "author": auth,
            "homepage": homepage,
            "url": path,
            "experimental": False,
            "filename": "",
            "status": "orphan",
            "error": error,
            "error_details": errorDetails,
            "repository": "",
            "localdir": key,
            "read-only": readOnly
        }
        return plugin
Example #8
0
    def getInstalledPlugin(self, key, path, readOnly, testLoad=True):
        """ get the metadata of an installed plugin """
        def metadataParser(fct):
            """ plugin metadata parser reimplemented from qgis.utils
                for better control on wchich module is examined
                in case there is an installed plugin masking a core one """
            global errorDetails
            cp = ConfigParser.ConfigParser()
            try:
                cp.readfp(codecs.open(metadataFile, "r", "utf8"))
                return cp.get('general', fct)
            except Exception as e:
                if not errorDetails:
                    errorDetails = e.args[0]  # set to the first problem
                return ""

        def pluginMetadata(fct):
            """ calls metadataParser for current l10n.
                If failed, fallbacks to the standard metadata """
            locale = QLocale.system().name()
            if locale and fct in translatableAttributes:
                value = metadataParser("%s[%s]" % (fct, locale))
                if value:
                    return value
                value = metadataParser("%s[%s]" % (fct, locale.split("_")[0]))
                if value:
                    return value
            return metadataParser(fct)

        if not QDir(path).exists():
            return

        global errorDetails  # to communicate with the metadataParser fn
        plugin = dict()
        error = ""
        errorDetails = ""
        version = None

        metadataFile = os.path.join(path, 'metadata.txt')
        if os.path.exists(metadataFile):
            version = normalizeVersion(pluginMetadata("version"))

        if version:
            qgisMinimumVersion = pluginMetadata("qgisMinimumVersion").strip()
            if not qgisMinimumVersion:
                qgisMinimumVersion = "0"
            qgisMaximumVersion = pluginMetadata("qgisMaximumVersion").strip()
            if not qgisMaximumVersion:
                qgisMaximumVersion = qgisMinimumVersion[0] + ".99"
            #if compatible, add the plugin to the list
            if not isCompatible(QGis.QGIS_VERSION, qgisMinimumVersion,
                                qgisMaximumVersion):
                error = "incompatible"
                errorDetails = "%s - %s" % (qgisMinimumVersion,
                                            qgisMaximumVersion)
            elif testLoad:
                # only testLoad if compatible version
                try:
                    pkg = __import__(key)
                    reload(pkg)
                    pkg.classFactory(iface)
                except Exception as e:
                    error = "broken"
                    errorDetails = unicode(e.args[0])
                except SystemExit as e:
                    error = "broken"
                    errorDetails = QCoreApplication.translate(
                        "QgsPluginInstaller",
                        "The plugin exited with error status: {0}").format(
                            e.args[0])
                except:
                    error = "broken"
                    errorDetails = QCoreApplication.translate(
                        "QgsPluginInstaller", "Unknown error")
        elif not os.path.exists(metadataFile):
            error = "broken"
            errorDetails = QCoreApplication.translate("QgsPluginInstaller",
                                                      "Missing metadata file")
        else:
            error = "broken"
            e = errorDetails
            errorDetails = QCoreApplication.translate(
                "QgsPluginInstaller", u"Error reading metadata")
            if e:
                errorDetails += ": " + e

        if not version:
            version = "?"

        if error[:16] == "No module named ":
            mona = error.replace("No module named ", "")
            if mona != key:
                error = "dependent"
                errorDetails = mona

        icon = pluginMetadata("icon")
        if QFileInfo(icon).isRelative():
            icon = path + "/" + icon

        plugin = {
            "id":
            key,
            "plugin_id":
            None,
            "name":
            pluginMetadata("name") or key,
            "description":
            pluginMetadata("description"),
            "about":
            pluginMetadata("about"),
            "icon":
            icon,
            "category":
            pluginMetadata("category"),
            "tags":
            pluginMetadata("tags"),
            "changelog":
            pluginMetadata("changelog"),
            "author_name":
            pluginMetadata("author_name") or pluginMetadata("author"),
            "author_email":
            pluginMetadata("email"),
            "homepage":
            pluginMetadata("homepage"),
            "tracker":
            pluginMetadata("tracker"),
            "code_repository":
            pluginMetadata("repository"),
            "version_installed":
            version,
            "library":
            path,
            "pythonic":
            True,
            "experimental":
            pluginMetadata("experimental").strip().upper() in ["TRUE", "YES"],
            "deprecated":
            pluginMetadata("deprecated").strip().upper() in ["TRUE", "YES"],
            "version_available":
            "",
            "zip_repository":
            "",
            "download_url":
            path,  # warning: local path as url!
            "filename":
            "",
            "downloads":
            "",
            "average_vote":
            "",
            "rating_votes":
            "",
            "available":
            False,  # Will be overwritten, if any available version found.
            "installed":
            True,
            "status":
            "orphan",  # Will be overwritten, if any available version found.
            "error":
            error,
            "error_details":
            errorDetails,
            "readonly":
            readOnly
        }
        return plugin
Example #9
0
    def getInstalledPlugin(self, key, path, readOnly, testLoad=True):
        """ get the metadata of an installed plugin """
        def metadataParser(fct):
            """ plugin metadata parser reimplemented from qgis.utils
                for better control on wchich module is examined
                in case there is an installed plugin masking a core one """
            global errorDetails
            cp = ConfigParser.ConfigParser()
            try:
                cp.readfp(codecs.open(metadataFile, "r", "utf8"))
                return cp.get('general', fct)
            except Exception as e:
                if not errorDetails:
                    errorDetails = e.args[0] # set to the first problem
                return ""

        def pluginMetadata(fct):
            """ calls metadataParser for current l10n.
                If failed, fallbacks to the standard metadata """
            locale = QLocale.system().name()
            if locale and fct in translatableAttributes:
                value = metadataParser("%s[%s]" % (fct, locale))
                if value:
                    return value
                value = metadataParser("%s[%s]" % (fct, locale.split("_")[0]))
                if value:
                    return value
            return metadataParser(fct)

        if not QDir(path).exists():
            return

        global errorDetails # to communicate with the metadataParser fn
        plugin = dict()
        error = ""
        errorDetails = ""
        version = None

        metadataFile = os.path.join(path, 'metadata.txt')
        if os.path.exists(metadataFile):
            version = normalizeVersion(pluginMetadata("version"))

        if version:
            qgisMinimumVersion = pluginMetadata("qgisMinimumVersion").strip()
            if not qgisMinimumVersion:
                qgisMinimumVersion = "0"
            qgisMaximumVersion = pluginMetadata("qgisMaximumVersion").strip()
            if not qgisMaximumVersion:
                qgisMaximumVersion = qgisMinimumVersion[0] + ".99"
            #if compatible, add the plugin to the list
            if not isCompatible(QGis.QGIS_VERSION, qgisMinimumVersion, qgisMaximumVersion):
                error = "incompatible"
                errorDetails = "%s - %s" % (qgisMinimumVersion, qgisMaximumVersion)
            elif testLoad:
                # only testLoad if compatible version
                try:
                    pkg = __import__(key)
                    reload(pkg)
                    pkg.classFactory(iface)
                except Exception as e:
                    error = "broken"
                    errorDetails = unicode(e.args[0])
                except SystemExit as e:
                    error = "broken"
                    errorDetails = QCoreApplication.translate("QgsPluginInstaller", "The plugin exited with error status: {0}").format(e.args[0])
                except:
                    error = "broken"
                    errorDetails = QCoreApplication.translate("QgsPluginInstaller", "Unknown error")
        elif not os.path.exists(metadataFile):
            error = "broken"
            errorDetails = QCoreApplication.translate("QgsPluginInstaller", "Missing metadata file")
        else:
            error = "broken"
            e = errorDetails
            errorDetails = QCoreApplication.translate("QgsPluginInstaller", u"Error reading metadata")
            if e:
                errorDetails += ": " + e

        if not version:
            version = "?"

        if error[:16] == "No module named ":
            mona = error.replace("No module named ", "")
            if mona != key:
                error = "dependent"
                errorDetails = mona

        icon = pluginMetadata("icon")
        if QFileInfo(icon).isRelative():
            icon = path + "/" + icon

        plugin = {
            "id": key,
            "plugin_id": None,
            "name": pluginMetadata("name") or key,
            "description": pluginMetadata("description"),
            "about": pluginMetadata("about"),
            "icon": icon,
            "category": pluginMetadata("category"),
            "tags": pluginMetadata("tags"),
            "changelog": pluginMetadata("changelog"),
            "author_name": pluginMetadata("author_name") or pluginMetadata("author"),
            "author_email": pluginMetadata("email"),
            "homepage": pluginMetadata("homepage"),
            "tracker": pluginMetadata("tracker"),
            "code_repository": pluginMetadata("repository"),
            "version_installed": version,
            "library": path,
            "pythonic": True,
            "experimental": pluginMetadata("experimental").strip().upper() in ["TRUE", "YES"],
            "deprecated": pluginMetadata("deprecated").strip().upper() in ["TRUE", "YES"],
            "version_available": "",
            "zip_repository": "",
            "download_url": path,      # warning: local path as url!
            "filename": "",
            "downloads": "",
            "average_vote": "",
            "rating_votes": "",
            "available": False,     # Will be overwritten, if any available version found.
            "installed": True,
            "status": "orphan",  # Will be overwritten, if any available version found.
            "error": error,
            "error_details": errorDetails,
            "readonly": readOnly}
        return plugin