Merged update from upstream sources

This is an automated DistroBaker update from upstream sources.
If you do not know what this is about or would like to opt out,
contact the OSCI team.

Source: https://src.fedoraproject.org/rpms/hplip.git#b2f875a7674e3bb5e14291d1abe9f6484cc256ec
This commit is contained in:
DistroBaker 2021-02-05 21:05:02 +00:00
parent 62e3d5426a
commit 68aa2fdae1
6 changed files with 156 additions and 268 deletions

13
hplip-fab-import.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/ui5/fabwindow.py b/ui5/fabwindow.py
index 0b95c94..631727c 100644
--- a/ui5/fabwindow.py
+++ b/ui5/fabwindow.py
@@ -518,7 +518,7 @@ class FABWindow(QMainWindow, Ui_MainWindow):
self.__tr("Import fax addresses from LDIF or vCard"),
#user_conf.workingDirectory(),
self.user_settings.working_dir,
- "vCard (*.vcf);;LDIF (*.ldif *.ldi)"))
+ "vCard (*.vcf);;LDIF (*.ldif *.ldi)")[0])
if result:
working_directory = to_unicode(os.path.dirname(result))

31
hplip-fedora-gui.patch Normal file
View File

@ -0,0 +1,31 @@
diff --git a/base/utils.py b/base/utils.py
index d493b54..401dc41 100644
--- a/base/utils.py
+++ b/base/utils.py
@@ -727,8 +727,8 @@ def canEnterGUIMode4(): # qt4
except ImportError:
try:
import ui5
- except ImportError as e:
- log.warn(e)
+ except ImportError:
+ log.error("hplip-gui not installed. GUI not available.")
return False
return True
@@ -746,6 +746,7 @@ def checkPyQtImport(): # qt3
try:
import ui
except ImportError:
+ log.error("hplip-gui not installed. GUI not available.")
return False
log.error("PyQt not installed. GUI not available. Exiting.")
@@ -800,6 +801,7 @@ def checkPyQtImport4():
import ui5
except ImportError:
log.debug('GUI not available.')
+ log.error('hplip-gui not installed. GUI not available.')
return False
return True

View File

@ -1,5 +1,5 @@
diff --git a/prnt/cups.py b/prnt/cups.py
index a9f410a..b3e7434 100644
index a9f410a..733891b 100644
--- a/prnt/cups.py
+++ b/prnt/cups.py
@@ -489,49 +489,72 @@ def getPPDFile2(mq,model, ppds): # New PPD find
@ -98,7 +98,7 @@ index a9f410a..b3e7434 100644
+ pdls.append(pdl)
+ ppd_model=ppd_model.replace('-{}'.format(pdl), '')
+
+ if ppd_model != wanted_model:
+ if ppd_model != wanted_model and ppd_model != '{}_series'.format(wanted_model):
+ continue
+
+ log.debug("Found match: %s" % f)

View File

@ -1,6 +1,6 @@
diff -up hplip-3.17.11/firmware.py.typo hplip-3.17.11/firmware.py
--- hplip-3.17.11/firmware.py.typo 2018-01-12 16:50:10.338366719 +0100
+++ hplip-3.17.11/firmware.py 2018-01-12 16:50:33.563184939 +0100
diff -up hplip-3.20.11/firmware.py.typo hplip-3.20.11/firmware.py
--- hplip-3.20.11/firmware.py.typo 2021-02-03 10:53:34.311743805 +0100
+++ hplip-3.20.11/firmware.py 2021-02-03 10:54:13.229386257 +0100
@@ -99,7 +99,7 @@ try:
if mode == GUI_MODE and (ui_toolkit == 'qt4' or ui_toolkit == 'qt5'):
if not utils.canEnterGUIMode4():

View File

@ -1,273 +1,96 @@
diff --git a/align.py b/align.py
index c5a66fe..9067676 100755
--- a/align.py
+++ b/align.py
@@ -241,8 +241,13 @@ try:
# log.error("Unable to load Qt4 support. Is it installed?")
# sys.exit(1)
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".aligndialog")
+ try:
+ ui = import_module(ui_package + ".aligndialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
#try:
if 1:
diff --git a/base/queues.py b/base/queues.py
index 04c37b1..dec7fe9 100755
--- a/base/queues.py
+++ b/base/queues.py
@@ -375,8 +375,14 @@ def main_function(passwordObj = None, mode = GUI_MODE, ui_toolkit= UI_TOOLKIT_QT
sys.exit(1)
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".queuesconf")
- setupdialog = import_module(ui_package + ".setupdialog")
diff --git a/base/module.py b/base/module.py
index dd3efa3..04ac5b8 100644
--- a/base/module.py
+++ b/base/module.py
@@ -432,6 +432,12 @@ class Module(object):
if show_usage is not None:
sys.exit(0)
+ if mode == GUI_MODE:
+ if not utils.canEnterGUIMode4():
+ log.warn("GUI mode not available - switching to interactive mode.")
+ mode = INTERACTIVE_MODE
+ ui_toolkit = 'none'
+
+ try:
+ ui = import_module(ui_package + ".queuesconf")
+ setupdialog = import_module(ui_package + ".setupdialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
app = QApplication(sys.argv)
dialog = ui.QueuesDiagnose(None, "","",QUEUES_MSG_SENDING,passwordObj)
self.mode = mode
return opts, device_uri, printer_name, mode, ui_toolkit, lang
diff --git a/base/utils.py b/base/utils.py
index cde819f..0d6e9ff 100644
index 98437a3..9b8813b 100644
--- a/base/utils.py
+++ b/base/utils.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
# -*- coding: utf-8 -*-
#
# (c) Copyright 2001-2018 HP Development Company, L.P.
@@ -734,6 +734,13 @@ def checkPyQtImport(): # qt3
@@ -722,6 +722,15 @@ def canEnterGUIMode4(): # qt4
log.warn(e)
return False
+ try:
+ import ui4
+ except ImportError:
+ try:
+ import ui5
+ except ImportError as e:
+ log.warn(e)
+ return False
+
return True
@@ -734,6 +743,11 @@ def checkPyQtImport(): # qt3
if os.getenv('DISPLAY') and os.getenv('STARTED_FROM_MENU'):
no_qt_message_gtk()
+ # hplip-gui sub-package (Fedora)
+ try:
+ import ui
+ except ImportError:
+ log.error("hplip-gui not installed. GUI not available. Exiting.")
+ return False
+
log.error("PyQt not installed. GUI not available. Exiting.")
return False
@@ -784,7 +791,8 @@ def checkPyQtImport4():
import PyQt5
import ui5
else:
@@ -781,11 +795,13 @@ def checkPyQtImport4():
import PyQt4
import ui4
except ImportError:
- import PyQt5
- import ui5
- else:
- log.debug("HPLIP is not installed properly or is installed without graphical support. Please reinstall HPLIP again")
+ # hplip-gui sub-package (Fedora) requires python3-qt5
+ log.error("Install the hplip-gui package for graphical support.")
return False
- return False
+ try:
+ import PyQt5
+ import ui5
+ except ImportError:
+ log.debug('GUI not available.')
+ return False
+
return True
@@ -2456,6 +2464,7 @@ def checkPyQtImport45():
except ImportError as e:
log.debug(e)
+ log.error("Install the hplip-gui package for graphical support.")
raise ImportError("GUI Modules PyQt4 and PyQt5 are not installed")
@@ -2477,6 +2486,7 @@ def import_dialog(ui_toolkit):
return (QApplication, "ui4")
except ImportError as e:
log.error(e)
+ log.error("Unable to load Qt support. Is hplip-gui package installed?")
sys.exit(1)
elif ui_toolkit == "qt5":
try:
@@ -2485,9 +2495,7 @@ def import_dialog(ui_toolkit):
return (QApplication, "ui5")
except ImportError as e:
log.error(e)
- sys.exit(1)
- else:
- log.error("Unable to load Qt support. Is it installed?")
+ log.error("Unable to load Qt support. Is hplip-gui package installed?")
sys.exit(1)
diff --git a/clean.py b/clean.py
index 3d41f04..0141f23 100755
--- a/clean.py
+++ b/clean.py
@@ -193,8 +193,13 @@ try:
else:
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".cleandialog")
+ try:
+ ui = import_module(ui_package + ".cleandialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
#try:
if 1:
diff --git a/diagnose_plugin.py b/diagnose_plugin.py
index e4e6ebd..1bcd8c3 100755
--- a/diagnose_plugin.py
+++ b/diagnose_plugin.py
@@ -94,7 +94,14 @@ if mode == GUI_MODE:
# sys.exit(1)
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".plugindiagnose")
+
+ try:
+ ui = import_module(ui_package + ".plugindiagnose")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
+
from installer import pluginhandler
app = QApplication(sys.argv)
# def checkPyQtImport5():
diff --git a/fab.py b/fab.py
index 9bd6166..e11ebc4 100755
index 5577af5..194ceed 100755
--- a/fab.py
+++ b/fab.py
@@ -854,8 +854,13 @@ if mode == GUI_MODE:
else: # qt4
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".fabwindow")
+ try:
+ ui = import_module(ui_package + ".fabwindow")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
log.set_module("hp-fab(qt4)")
diff --git a/firmware.py b/firmware.py
index 33e044d..a38058b 100755
--- a/firmware.py
+++ b/firmware.py
@@ -118,7 +118,13 @@ try:
# log.error("Unable to load Qt4 support. Is it installed?")
# sys.exit(1)
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".firmwaredialog")
+
+ try:
+ ui = import_module(ui_package + ".firmwaredialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
if ui_toolkit == 'qt3':
try:
diff --git a/info.py b/info.py
index 6c28531..5b05eda 100755
--- a/info.py
+++ b/info.py
@@ -172,7 +172,13 @@ try:
else: # GUI mode
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".infodialog")
+
+ try:
+ ui = import_module(ui_package + ".infodialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
if 1:
app = QApplication(sys.argv)
diff --git a/plugin.py b/plugin.py
index f54f726..58d6006 100755
--- a/plugin.py
+++ b/plugin.py
@@ -252,7 +252,14 @@ if mode == GUI_MODE:
# clean_exit(1)
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".plugindialog")
+
+ try:
+ ui = import_module(ui_package + ".plugindialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
+
if ui_toolkit == "qt5":
from PyQt5.QtWidgets import QMessageBox
elif ui_toolkit == "qt4":
diff --git a/sendfax.py b/sendfax.py
index 491c8f9..0815ee7 100755
--- a/sendfax.py
+++ b/sendfax.py
@@ -211,7 +211,13 @@ if mode == GUI_MODE:
# sys.exit(1)
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".sendfaxdialog")
+
+ try:
+ ui = import_module(ui_package + ".sendfaxdialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
app = QApplication(sys.argv)
dlg = ui.SendFaxDialog(None, printer_name, device_uri, mod.args)
diff --git a/setup.py b/setup.py
index 2608f95..b09a8ef 100755
--- a/setup.py
+++ b/setup.py
@@ -310,7 +310,12 @@ if mode == GUI_MODE:
# clean_exit(1)
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".setupdialog")
+ try:
+ ui = import_module(ui_package + ".setupdialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
app = QApplication(sys.argv)
log.debug("Sys.argv=%s printer_name=%s param=%s jd_port=%s device_uri=%s remove=%s" % (sys.argv, printer_name, param, jd_port, device_uri, remove))
diff --git a/testpage.py b/testpage.py
index a5ed2bc..2a707a1 100755
--- a/testpage.py
+++ b/testpage.py
@@ -77,7 +77,13 @@ try:
# log.error("Unable to load Qt4 support. Is it installed?")
# sys.exit(1)
QApplication, ui_package = utils.import_dialog(ui_toolkit)
- ui = import_module(ui_package + ".printtestpagedialog")
+
+ try:
+ ui = import_module(ui_package + ".printtestpagedialog")
+ except ModuleNotFoundError:
+ log.error('HPLIP GUI is not available - use interactive mode '
+ '(option \'-i\') or install hplip-gui package.')
+ sys.exit(1)
log.set_module("%s(UI)" % __mod__)
@@ -776,14 +776,15 @@ mod.setUsage(module.USAGE_FLAG_NONE)
opts, device_uri, printer_name, mode, ui_toolkit, loc = \
mod.parseStdOpts(handle_device_printer=False)
-if ui_toolkit == 'qt3':
- if not utils.canEnterGUIMode():
- log.error("%s GUI mode requires GUI support (try running with --qt4). Entering interactive mode." % __mod__)
- mode = INTERACTIVE_MODE
-else:
- if not utils.canEnterGUIMode4():
- log.error("%s GUI mode requires GUI support (try running with --qt3). Entering interactive mode." % __mod__)
- mode = INTERACTIVE_MODE
+if ui_toolkit != 'none':
+ if ui_toolkit == 'qt3':
+ if not utils.canEnterGUIMode():
+ log.error("%s GUI mode requires GUI support (try running with --qt4). Entering interactive mode." % __mod__)
+ mode = INTERACTIVE_MODE
+ else:
+ if not utils.canEnterGUIMode4():
+ log.error("%s GUI mode requires GUI support (try running with --qt3). Entering interactive mode." % __mod__)
+ mode = INTERACTIVE_MODE
if mode == GUI_MODE:

View File

@ -7,7 +7,7 @@
Summary: HP Linux Imaging and Printing Project
Name: hplip
Version: 3.20.11
Release: 3%{?dist}
Release: 5%{?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
@ -168,6 +168,15 @@ Patch58: hplip-timeb-removed.patch
# non-sudoers cannot authenticate
# reported upstream https://bugs.launchpad.net/hplip/+bug/1904888
Patch59: hplip-check-userperms.patch
# 1919556 - hp-fab crashed: QFileDialog.getOpenFileName is not used correctly
# getOpenFileName returns a tuple, but hp-fab expects a simple variable
# reported upstream as https://bugs.launchpad.net/hplip/+bug/1914743
Patch60: hplip-fab-import.patch
%if 0%{?fedora} || 0%{?rhel} <= 8
# mention hplip-gui if you want to have GUI
Patch1000: hplip-fedora-gui.patch
%endif
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
@ -451,6 +460,13 @@ rm prnt/hpcups/ErnieFilter.{cpp,h} prnt/hpijs/ernieplatform.h
%patch58 -p1 -b .timed-removed
# 1899410 - non-sudoers cannot authenticate because of bad username in prompt
%patch59 -p1 -b .check-userperms
# 1919556 - hp-fab crashed: QFileDialog.getOpenFileName is not used correctly
%patch60 -p1 -b .fab-import
%if 0%{?fedora} || 0%{?rhel} <= 8
# mention hplip-gui should be installed if you want GUI
%patch1000 -p1 -b .fedora-gui
%endif
sed -i.duplex-constraints \
-e 's,\(UIConstraints.* \*Duplex\),//\1,' \
@ -536,6 +552,7 @@ rm -f %{buildroot}%{_bindir}/foomatic-rip \
%if 0%{?rhel} > 8
rm -rf %{buildroot}%{_bindir}/hp-check \
%{buildroot}%{_bindir}/hp-devicesettings \
%{buildroot}%{_bindir}/hp-diagnose_plugin \
%{buildroot}%{_bindir}/hp-faxsetup \
%{buildroot}%{_bindir}/hp-linefeedcal \
%{buildroot}%{_bindir}/hp-makecopies \
@ -552,6 +569,7 @@ rm -rf %{buildroot}%{_bindir}/hp-check \
%{buildroot}%{_datadir}/hplip/base/imageprocessing.py* \
%{buildroot}%{_datadir}/hplip/check.py* \
%{buildroot}%{_datadir}/hplip/devicesettings.py* \
%{buildroot}%{_datadir}/hplip/diagnose_plugin.py* \
%{buildroot}%{_datadir}/hplip/faxsetup.py* \
%{buildroot}%{_datadir}/hplip/linefeedcal.py* \
%{buildroot}%{_datadir}/hplip/makecopies.py* \
@ -639,11 +657,6 @@ rm -f %{buildroot}%{_unitdir}/hplip-printer@.service
# window), so don't ship the launcher yet.
rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
# hp-setup needs to have cups service enabled and running for setups of queues
%pre
%{_bindir}/systemctl start cups &>/dev/null ||:
%{_bindir}/systemctl enable cups &>/dev/null ||:
%post
# timeout is to prevent possible freeze during update
%{_bindir}/timeout 10m -k 15m %{_bindir}/hpcups-update-ppds &>/dev/null ||:
@ -661,7 +674,6 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%{_bindir}/hp-clean
%{_bindir}/hp-colorcal
%{_bindir}/hp-config_usb_printer
%{_bindir}/hp-diagnose_plugin
%{_bindir}/hp-diagnose_queues
%{_bindir}/hp-fab
%{_bindir}/hp-firmware
@ -695,7 +707,6 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%{_datadir}/hplip/clean.py*
%{_datadir}/hplip/colorcal.py*
%{_datadir}/hplip/config_usb_printer.py*
%{_datadir}/hplip/diagnose_plugin.py*
%{_datadir}/hplip/diagnose_queues.py*
%{_datadir}/hplip/fab.py*
%{_datadir}/hplip/fax
@ -761,6 +772,7 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%files gui
%{_bindir}/hp-check
%{_bindir}/hp-devicesettings
%{_bindir}/hp-diagnose_plugin
%{_bindir}/hp-faxsetup
%{_bindir}/hp-linefeedcal
%{_bindir}/hp-makecopies
@ -776,6 +788,7 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/hplip/check.py*
%{_datadir}/hplip/devicesettings.py*
%{_datadir}/hplip/diagnose_plugin.py*
%{_datadir}/hplip/faxsetup.py*
%{_datadir}/hplip/linefeedcal.py*
%{_datadir}/hplip/makecopies.py*
@ -797,6 +810,14 @@ rm -f %{buildroot}%{_sysconfdir}/xdg/autostart/hplip-systray.desktop
%config(noreplace) %{_sysconfdir}/sane.d/dll.d/hpaio
%changelog
* Fri Feb 05 2021 Zdenek Dohnal <zdohnal@redhat.com> - 3.20.11-5
- 1925259 - %pre scriptlet enables and starts cups.service, which is unnecessary
- 1919556 - hp-fab crashed: QFileDialog.getOpenFileName is not used correctly
* Tue Feb 02 2021 Zdenek Dohnal <zdohnal@redhat.com> - 3.20.11-4
- 1912147 - Enable matching for '<model>_series' drivers in PPD search algorithm
- rework optional gui messages
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 3.20.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild