modoboa / modoboa-installer

An installer for Modoboa
MIT License
254 stars 135 forks source link

Installer fails to determine modoba version #545

Closed Kepas-Beleglorn closed 5 months ago

Kepas-Beleglorn commented 5 months ago

Impacted versions

Steps to reproduce

Full trace using --debug option or current behaviour

Expected behavior

Possible solution

I modified my local copy of the script like this, to make things more generic:

    """Returns the version of an installed package."""
    cmd = "{} show {}".format(
        get_pip_path(venv),
        name
    )
    exit_code, output = utils.exec_cmd(cmd, **kwargs)
    if exit_code != 0:
        utils.error(f"Failed to get version of {name}. "
                    f"Output is: {output}")
        sys.exit(1)

    output_list = output.decode().split("\n")
#vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    for output_element in output_list:
        version_item_list = output_element.split(":")
        if version_item_list[0] == "Version":
            version_list = version_item_list[1].split(".")
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    version_list_clean = []
    for element in version_list:
        try:
            version_list_clean.append(int(element))
        except ValueError:
            utils.printcolor(
                f"Failed to decode some part of the version of {name}",
                utils.YELLOW)
            version_list_clean.append(element)
    return version_list_clean
tonioo commented 5 months ago

Are you trying to install on a regular Debian distribution? Or is it a special flavor for raspberry?

tonioo commented 5 months ago

https://github.com/modoboa/modoboa-installer/commit/9eda3b81bed65c0e4277c1276dbd7df14012a051