fa4d51b840
Upgrade to 3.20.9 OBS-URL: https://build.opensuse.org/request/show/850181 OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=204
57 lines
2.2 KiB
Diff
57 lines
2.2 KiB
Diff
From 5ff90c0210be6b9b48f5cc269d2450e85a958ec0 Mon Sep 17 00:00:00 2001
|
|
From: Martin Wilck <mwilck@suse.com>
|
|
Date: Mon, 16 Mar 2020 14:33:35 +0100
|
|
Subject: [PATCH] Use lsb_release fallback code if "import distro" fails
|
|
|
|
With python 3.8, the standard python "platform" module doesn't
|
|
provide the "dist()" function any more. The "distro" module is
|
|
used instead. However, not all distributions ship the "distro"
|
|
module by default. Catch the resulting exception, and use the
|
|
already existing fallback code to determine the distribution
|
|
using lsb_release.
|
|
---
|
|
base/password.py | 8 ++++++--
|
|
installer/core_install.py | 10 +++++++---
|
|
2 files changed, 13 insertions(+), 5 deletions(-)
|
|
|
|
Index: hplip-3.20.9/base/password.py
|
|
===================================================================
|
|
--- hplip-3.20.9.orig/base/password.py
|
|
+++ hplip-3.20.9/base/password.py
|
|
@@ -84,8 +84,12 @@ def get_distro_name():
|
|
try:
|
|
os_name = platform.dist()[0]
|
|
except AttributeError:
|
|
- import distro
|
|
- os_name = distro.linux_distribution()[0]
|
|
+ try:
|
|
+ import distro
|
|
+ os_name = distro.linux_distribution()[0]
|
|
+ except (ImportError, AttributeError):
|
|
+ # Use fallback code below
|
|
+ pass
|
|
|
|
if not os_name:
|
|
name = os.popen('lsb_release -i | cut -f 2')
|
|
Index: hplip-3.20.9/installer/core_install.py
|
|
===================================================================
|
|
--- hplip-3.20.9.orig/installer/core_install.py
|
|
+++ hplip-3.20.9/installer/core_install.py
|
|
@@ -647,9 +647,13 @@ class CoreInstall(object):
|
|
name = platform.dist()[0].lower()
|
|
ver = platform.dist()[1]
|
|
except AttributeError:
|
|
- import distro
|
|
- name = distro.linux_distribution()[0].lower()
|
|
- ver = distro.linux_distribution()[1]
|
|
+ try:
|
|
+ import distro
|
|
+ name = distro.linux_distribution()[0].lower()
|
|
+ ver = distro.linux_distribution()[1]
|
|
+ except (ImportError, AttributeError):
|
|
+ # Use fallback code below
|
|
+ pass
|
|
|
|
if not name:
|
|
found = False
|