From 2563319e0e84405121010b733dc849c8b283d0d9 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Mon, 18 Nov 2019 01:12:58 -0500
Subject: [PATCH] core: Switch from platform.linux_distribution() to
distro.id()
The platform.linux_distribution() and platform.dist() methods have
been removed in Python 3.8.
The suggested replacement is using the third party distro module.
---
osc/core.py | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/osc/core.py b/osc/core.py
index b1289e48..d1fb89e9 100644
--- a/osc/core.py
+++ b/osc/core.py
@@ -4022,11 +4022,8 @@ def get_default_editor():
if system == 'Windows':
return 'notepad'
if system == 'Linux':
- try:
- # Python 2.6
- dist = platform.linux_distribution()[0]
- except AttributeError:
- dist = platform.dist()[0]
+ import distro
+ dist = distro.id()
if dist == 'debian':
return 'editor'
elif dist == 'fedora':
@@ -4040,11 +4037,8 @@ def get_default_pager():
if system == 'Windows':
return 'less'
if system == 'Linux':
- try:
- # Python 2.6
- dist = platform.linux_distribution()[0]
- except AttributeError:
- dist = platform.dist()[0]
+ import distro
+ dist = distro.id()
if dist == 'debian':
return 'pager'
return 'less'
--
2.21.0