1745317 - hp-plugin is broken on Rawhide

This commit is contained in:
Zdenek Dohnal 2019-09-06 14:19:53 +02:00
parent a86dc8a8fe
commit e4254ee67e
2 changed files with 68 additions and 1 deletions

58
hplip-dist-removed.patch Normal file
View File

@ -0,0 +1,58 @@
diff --git a/base/password.py b/base/password.py
index 45c6641..9e573c3 100644
--- a/base/password.py
+++ b/base/password.py
@@ -78,10 +78,15 @@ def get_distro_name():
os_name = None
try:
import platform
- os_name = platform.dist()[0]
except ImportError:
os_name = None
+ try:
+ os_name = platform.dist()[0]
+ except AttributeError:
+ import distro
+ os_name = distro.linux_distribution()[0]
+
if not os_name:
name = os.popen('lsb_release -i | cut -f 2')
os_name = name.read().strip()
@@ -139,8 +144,12 @@ class Password(object):
try:
self.__authType = AUTH_TYPES[distro_name]
if distro_name == 'fedora':
- import platform
- ver = int(platform.dist()[1])
+ import platform
+ try:
+ ver = int(platform.dist()[1])
+ except AttributeError:
+ import distro
+ ver = int(distro.linux_distribution()[1])
if ver >= 28:
self.__authType = AUTH_TYPES['fedora28']
except KeyError:
diff --git a/installer/core_install.py b/installer/core_install.py
index 9a3b5ac..af1348d 100644
--- a/installer/core_install.py
+++ b/installer/core_install.py
@@ -640,8 +640,15 @@ class CoreInstall(object):
# Getting distro information using platform module
try:
import platform
- name = platform.dist()[0].lower()
- ver = platform.dist()[1]
+ try:
+ name = platform.dist()[0].lower()
+ ver = platform.dist()[1]
+ except AttributeError:
+ import distro
+
+ name = distro.linux_distribution()[0].lower()
+ ver = distro.linux_distribution()[1]
+
if not name:
found = False
log.debug("Not able to detect distro")

View File

@ -7,7 +7,7 @@
Summary: HP Linux Imaging and Printing Project
Name: hplip
Version: 3.19.6
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2+ and MIT and BSD and IJG and Public Domain and GPLv2+ with exceptions and ISC
Url: https://developers.hp.com/hp-linux-imaging-and-printing
@ -114,6 +114,10 @@ Patch49: hplip-logging-segfault.patch
# wanted to report upstream, but launchpad ends with timeout error
# bugzilla https://bugzilla.redhat.com/show_bug.cgi?id=1738321
Patch50: hplip-systray-blockerror.patch
# platform module removed dist methode, using distro instead of it
# https://bugzilla.redhat.com/show_bug.cgi?id=1745317
# reported upstream https://bugs.launchpad.net/hplip/+bug/1843037
Patch51: hplip-dist-removed.patch
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: python3-pillow
@ -366,6 +370,8 @@ rm prnt/hpcups/ErnieFilter.{cpp,h} prnt/hpijs/ernieplatform.h
%patch49 -p1 -b .logging-segfault
# 1738321 - [abrt] hp-systray:BlockingIOError: [Errno 11] Resource temporarily unavailable
%patch50 -p1 -b .systray-blockerror
# 1745317 - hp-plugin is broken on Rawhide
%patch51 -p1 -b .dist-removed
sed -i.duplex-constraints \
-e 's,\(UIConstraints.* \*Duplex\),//\1,' \
@ -670,6 +676,9 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio
%changelog
* Fri Sep 06 2019 Zdenek Dohnal <zdohnal@redhat.com> - 3.19.6-7
- 1745317 - hp-plugin is broken on Rawhide
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 3.19.6-6
- Rebuilt for Python 3.8