Commit Graph

10 Commits

Author SHA1 Message Date
Rodolfo García Peñas (kix)
b51fa3b9f6 distro_utils.py get dictionary value using get
This patch use get to get the value of os_name. Else, None is get.
2020-11-01 08:29:15 +01:00
Rodolfo García Peñas (kix)
4e31762ec6 distro_utils.py added docstring
Remove pylint warning about

C0114: Missing module docstring (missing-module-docstring)
2020-11-01 08:23:28 +01:00
Rodolfo García Peñas (kix)
47f7b1ba3c get_os_sslcertfile_searchpath do not check iterable
Now, location is always an iterable, so we don't need check it.
2020-10-25 17:32:38 +01:00
Rodolfo García Peñas (kix)
a1f8576937 distro_utils do not compare types
This patch now use isinstance to compare types.
2020-10-25 17:27:40 +01:00
Rodolfo García Peñas (kix)
fe25a5c752 Distro default certificates must be iterables
This patch changes the __DEF_OS_LOCATIONS to an iterable value.

The reason is because a list is an iterable, but an string is an
iterable too, and this is a mistake.

The function get_os_sslcertfile() has a loop to iterate the return of
get_os_sslcertfile_searchpath(), that returns the value in the
__DEF_OS_LOCATIONS dictionary. When the value is an iterable, the "f"
variable is set to the iterable value and works fine.
If the value of "f" is an string, the for-loop iterates over every
character, so the test for os.path.exists is always false (is comparing
the path with a character, not with the full path), so this function
fails and return None.

To check this change, edit your .offlineimaprc file and change the
sslcacertfile to OS-DEFAULT:

sslcacertfile = OS-DEFAULT

And run offlineimap. If you are not using 'darwin0 (the only iterable)
it will fails. Now, apply this patch, and run offlineimap again. Problem
is solved.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2020-10-25 17:26:20 +01:00
Rodolfo García Peñas (kix)
bde48fe2c7 Renamed l variable to location_name
This variable is renamed to avoid a warning about ambiguous name.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2020-10-25 16:42:09 +01:00
Rodolfo García Peñas (kix)
5777553a96 Renamed l variable to location_name
This variable is renamed to avoid a warning about ambiguous name.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2020-10-25 16:40:50 +01:00
Rodolfo García Peñas (kix)
714cbe2327 Renamed OS to os_name in get_os_sslcertificate_searchpath
This patch changes this variable name only.
2020-10-25 16:40:07 +01:00
Rodolfo García Peñas (kix)
07c1a5c9db Deprecated linux_distribution
The call from platform.linux_distribution was depdrecated in Python 3.7.

This patch solves this problem, using the recomended package distro.

Signed-off-by: Rodolfo García Peñas (kix) <kix@kix.es>
2020-10-25 16:38:16 +01:00
Rodolfo García Peñas (kix)
f66bfb0026 Renamed utils/distro.py
The file utils/distro.py is renamed to utils/distro_utils.py
because we need import the distro file to update some calls.

The file is used in IMAP.py, I need change the import.
2020-10-25 16:33:52 +01:00