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:
		| @@ -5,6 +5,12 @@ | |||||||
| import platform | import platform | ||||||
| import os | 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. | # Each dictionary value is either string or some iterable. | ||||||
| # | # | ||||||
| # For the former we will just return the value, for an 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() |     os_name = platform.system().lower() | ||||||
|  |  | ||||||
|     if os_name.startswith('linux'): |     if os_name.startswith('linux'): | ||||||
|         distro_name = platform.linux_distribution()[0] |         distro_name = linux_distribution()[0] | ||||||
|         if distro_name: |         if distro_name: | ||||||
|             os_name = os_name + "-%s" % distro_name.split()[0].lower() |             os_name = os_name + "-%s" % distro_name.split()[0].lower() | ||||||
|         if os.path.exists('/etc/arch-release'): |         if os.path.exists('/etc/arch-release'): | ||||||
|   | |||||||
| @@ -2,3 +2,4 @@ | |||||||
| gssapi[kerberos] | gssapi[kerberos] | ||||||
| portalocker[cygwin] | portalocker[cygwin] | ||||||
| rfc6555 | rfc6555 | ||||||
|  | distro | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Rodolfo García Peñas (kix)
					Rodolfo García Peñas (kix)