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>
This commit is contained in:
Rodolfo García Peñas (kix) 2020-10-25 16:38:16 +01:00
parent f66bfb0026
commit 07c1a5c9db
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,12 @@
import platform
import os
# linux_distribution deprecated in Python 3.7
try:
from platform import linux_distribution
except ImportError:
from distro import linux_distribution
# Each dictionary value is either string or some iterable.
#
# For the former we will just return the value, for an iterable
@ -45,7 +51,7 @@ def get_os_name():
os_name = platform.system().lower()
if os_name.startswith('linux'):
distro_name = platform.linux_distribution()[0]
distro_name = linux_distribution()[0]
if distro_name:
os_name = os_name + "-%s" % distro_name.split()[0].lower()
if os.path.exists('/etc/arch-release'):

View File

@ -2,3 +2,4 @@
gssapi[kerberos]
portalocker[cygwin]
rfc6555
distro