- Use LSB fallback if distro determination (bsc#1166623)
* Add patch: Use-lsb_release-fallback-code-if-import-distro-fails.patch OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=193
This commit is contained in:
59
Use-lsb_release-fallback-code-if-import-distro-fails.patch
Normal file
59
Use-lsb_release-fallback-code-if-import-distro-fails.patch
Normal file
@@ -0,0 +1,59 @@
|
||||
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(-)
|
||||
|
||||
diff --git a/base/password.py b/base/password.py
|
||||
index cc91ac7..4352f9d 100644
|
||||
--- a/base/password.py
|
||||
+++ b/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')
|
||||
diff --git a/installer/core_install.py b/installer/core_install.py
|
||||
index eaecdc6..8c6b67f 100644
|
||||
--- a/installer/core_install.py
|
||||
+++ b/installer/core_install.py
|
||||
@@ -644,9 +644,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
|
||||
--
|
||||
2.25.1
|
||||
|
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 16 13:40:14 UTC 2020 - Martin Wilck <mwilck@suse.com>
|
||||
|
||||
- Use LSB fallback if distro determination (bsc#1166623)
|
||||
* Add patch: Use-lsb_release-fallback-code-if-import-distro-fails.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Mar 16 09:15:53 UTC 2020 - Johannes Meixner <jsmeix@suse.com>
|
||||
|
||||
|
@@ -74,6 +74,8 @@ Patch302: hp_ipp.h-add-missing-prototypes.patch
|
||||
Patch303: photocard-fix-import-error-for-pcardext.patch
|
||||
# bsc#1159240, lp#1859179
|
||||
Patch304: hp-sendfax-avoid-crash-if-python-reportlab-is-missin.patch
|
||||
# bsc#1166623, hp-toolbox crashes without python3-distro module
|
||||
Patch305: Use-lsb_release-fallback-code-if-import-distro-fails.patch
|
||||
# PATCH-FIX-SUSE: Remove references to the closed-source ImageProcessor
|
||||
Patch400: hplip-remove-imageprocessor.diff
|
||||
# Let a function return NULL instead of nothing
|
||||
@@ -320,6 +322,7 @@ This sub-package is only required by developers.
|
||||
%patch302 -p1 -b .hp_ipp_missing_prototypes
|
||||
%patch303 -p1 -b .photocard_import
|
||||
%patch304 -p1
|
||||
%patch305 -p1
|
||||
%patch400 -p1
|
||||
%patch401 -p1
|
||||
%patch402 -p1
|
||||
|
Reference in New Issue
Block a user