Beispiel #1
0
def package_list_name():
    pluginDict = utils.list_plugin_name()
    pluginName = []
    shortName = []
    latestRelease = []
    description = []
    for p in pluginDict.keys():
        if utils.check_download(utils.URL + "/" + utils.RUDDER_VERSION + "/" +
                                str(pluginDict[p][0])):
            pluginName.append(str(p))
            shortName.append(str(pluginDict[p][0]))
            description.append(str(pluginDict[p][1]))

            pkgs = plugin.Plugin(p)
            pkgs.getAvailablePackages()
            try:
                latestVersion = pkgs.getLatestCompatibleRelease(
                    None).version.pluginLongVersion
            except:
                latestVersion = ""
            latestRelease.append(latestVersion)
    table = [{
        "title": "Plugin Name",
        "value": pluginName
    }, {
        "title": "Plugin Short Name",
        "value": shortName
    }, {
        "title": "Description",
        "value": description
    }, {
        "title": "Latest release",
        "value": latestRelease
    }]
    print(utils.dictToAsciiTable(table))
Beispiel #2
0
def package_search(name):
    utils.readConf()
    pkgs = plugin.Plugin(name[0])
    pkgs.getAvailablePackages()
    pluginName = []
    releaseMode = []
    version = []
    compatible = []

    for iRpkg in sorted(pkgs.packagesInfo):
        data = iRpkg.toTabulate()
        pluginName.append(data[0])
        releaseMode.append(data[1])
        version.append(data[2])
        compatible.append(data[3])

    table = [
        {
            "title": "Plugin Name",
            "value": pluginName
        },
        {
            "title": "Release Mode",
            "value": releaseMode
        },
        {
            "title": "Version",
            "value": version
        },
        {
            "title": "Compatible",
            "value": compatible
        },
    ]
    print(utils.dictToAsciiTable(table))
Beispiel #3
0
def package_list_installed():
    toPrint = []
    printLatest = os.path.isfile(utils.INDEX_PATH)

    pluginName = []
    version = []
    latestRelease = []

    for p in utils.DB["plugins"].keys():
        pluginName.append(p)
        currentVersion = rpkg.PluginVersion(utils.DB["plugins"][p]["version"])
        version.append(currentVersion.pluginLongVersion)
        extra = ""
        try:
            if printLatest:
                pkgs = plugin.Plugin(p)
                pkgs.getAvailablePackages()
                latestVersion = pkgs.getLatestCompatibleRelease().version
                if currentVersion < latestVersion:
                    extra = "version %s is available"%(latestVersion.pluginLongVersion)
                latestRelease.append(latestVersion.pluginLongVersion + " " + extra)
            else:
                latestRelease.append("")
        except:
            latestRelease.append("")

    table = [
                { "title": "Plugin Name", "value": pluginName },
                { "title": "Version"    , "value": version    },
            ]
    if printLatest:
        table.append({ "title": "Latest release", "value": latestRelease })
    print(utils.dictToAsciiTable(table))
Beispiel #4
0
def package_list_installed():
    toPrint = []
    printLatest = os.path.isfile(utils.INDEX_PATH)

    pluginName = []
    version = []
    latestRelease = []
    currentStatus = []

    for p in utils.DB["plugins"].keys():
        pluginName.append(p)

        # Get version
        currentVersion = rpkg.PluginVersion(utils.DB["plugins"][p]["version"])
        version.append(currentVersion.pluginLongVersion)

        # Get status
        # Only plugin containing jars can be disabled
        status = "enabled"
        if not os.path.exists(utils.PLUGINS_CONTEXT_XML):
            return
        text = open(utils.PLUGINS_CONTEXT_XML).read()
        match = re.search(r'<Set name="extraClasspath">(.*?)</Set>', text)
        if match:
            enabled = match.group(1).split(',')
        metadata = utils.DB["plugins"][p]
        if 'jar-files' in metadata:
            for j in metadata['jar-files']:
                if j not in enabled:
                    status = "disabled"
        currentStatus.append(status)

        # Get latest available version
        extra = ""
        try:
            if printLatest:
                pkgs = plugin.Plugin(p)
                pkgs.getAvailablePackages()
                latestVersion = pkgs.getLatestCompatibleRelease().version
                if currentVersion < latestVersion:
                    extra = "version %s is available" % (
                        latestVersion.pluginLongVersion)
                latestRelease.append(latestVersion.pluginLongVersion + " " +
                                     extra)
            else:
                latestRelease.append("")
        except:
            latestRelease.append("")

    table = [
        {
            "title": "Plugin Name",
            "value": pluginName
        },
        {
            "title": "Version",
            "value": version
        },
        {
            "title": "Status",
            "value": currentStatus
        },
    ]
    if printLatest:
        table.insert(2, {"title": "Latest release", "value": latestRelease})
    print(utils.dictToAsciiTable(table))