Hello community,

here is the log from the commit of package hplip for openSUSE:Factory checked 
in at 2020-03-19 19:46:49
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hplip (Old)
 and      /work/SRC/openSUSE:Factory/.hplip.new.3160 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hplip"

Thu Mar 19 19:46:49 2020 rev:131 rq:785667 version:3.19.12

Changes:
--------
--- /work/SRC/openSUSE:Factory/hplip/hplip.changes      2020-01-23 
16:10:44.691629824 +0100
+++ /work/SRC/openSUSE:Factory/.hplip.new.3160/hplip.changes    2020-03-19 
19:50:10.496179804 +0100
@@ -1,0 +2,12 @@
+Mon Mar 16 13:40:14 UTC 2020 - Martin Wilck <[email protected]>
+
+- Use LSB fallback if distro determination fails (bsc#1166623)
+  * Add patch: Use-lsb_release-fallback-code-if-import-distro-fails.patch
+- Removed python3-distro dependency again, not necessary any more.
+
+-------------------------------------------------------------------
+Mon Mar 16 09:15:53 UTC 2020 - Johannes Meixner <[email protected]>
+
+- Recommend python3-distro (boo#1166623)
+
+-------------------------------------------------------------------

New:
----
  Use-lsb_release-fallback-code-if-import-distro-fails.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hplip.spec ++++++
--- /var/tmp/diff_new_pack.cC6HpI/_old  2020-03-19 19:50:12.172180770 +0100
+++ /var/tmp/diff_new_pack.cC6HpI/_new  2020-03-19 19:50:12.180180775 +0100
@@ -74,6 +74,8 @@
 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
@@ -313,6 +315,7 @@
 %patch302 -p1 -b .hp_ipp_missing_prototypes
 %patch303 -p1 -b .photocard_import
 %patch304 -p1
+%patch305 -p1
 %patch400 -p1
 %patch401 -p1
 %patch402 -p1

++++++ Use-lsb_release-fallback-code-if-import-distro-fails.patch ++++++
>From 5ff90c0210be6b9b48f5cc269d2450e85a958ec0 Mon Sep 17 00:00:00 2001
From: Martin Wilck <[email protected]>
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





Reply via email to