run the modoba installer on raspberryPI with deactivated WLAN module
This will generate the unexpected (by the script) output
Use raspi-config to set the country before use.```
Therefore the index [1] is NOT the line containing the version.
Full trace using --debug option or current behaviour
Installer fails on modoba with this error
File "/home/pi/modoboa-installer/./run.py", line 282, in <module>
main(sys.argv[1:])
File "/home/pi/modoboa-installer/./run.py", line 266, in main
scripts.install(appname, config, args.upgrade, args.restore)
File "/home/pi/modoboa-installer/modoboa_installer/scripts/__init__.py", line 29, in install
getattr(script, appname.capitalize())(config, upgrade, archive_path).run()
File "/home/pi/modoboa-installer/modoboa_installer/scripts/base.py", line 202, in run
self.setup_user()
File "/home/pi/modoboa-installer/modoboa_installer/scripts/modoboa.py", line 217, in setup_user
self._setup_venv()
File "/home/pi/modoboa-installer/modoboa_installer/scripts/modoboa.py", line 110, in _setup_venv
modoboa_version = ".".join(str(i) for i in python.get_package_version(
File "/home/pi/modoboa-installer/modoboa_installer/python.py", line 68, in get_package_version
version_list = version_item_list[1].split(".")
IndexError: list index out of range
Expected behavior
Installer is able to determine version correct
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
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: