Created attachment 226807 [details] replace platform.dist with platform.libc_ver() print/hplip pkg installs ok, printing works, but hp-toolbox crashes. Problem is in base/password.py which calls depreciated/non-existent platform.dist() Changing that to platform.libc_vers() makes hp-tools start without problem. I’m not sure should distro.linux_distribution() be removed as well. patch-password.py --- base/password.py.orig 2021-07-30 21:24:44.609836000 +0200 +++ base/password.py @@ -82,7 +82,7 @@ os_name = None try: - os_name = platform.dist()[0] + os_name = platform.libc_ver()[0] except AttributeError: import distro os_name = distro.linux_distribution()[0]
(In reply to Vladimir Mišev from comment #0) Sorry, I made a typo in my description: :%s/libc_vers/libc_ver/g Patch is ok.
(In reply to Vladimir Mišev from comment #1) Was the problem ever solved, please? On my FreeBSD 13.0-RELEASE I cannot use hp-toolbox: hp-toolbox HP Linux Imaging and Printing System (ver. 3.20.6) HP Device Manager ver. 15.0 Copyright (c) 2001-18 HP Development Company, LP This software comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to distribute it under certain conditions. See COPYING file for more details. /usr/local/share/hplip/ui5/devmgr_ext.py:15: SyntaxWarning: "is not" with a literal. Did you mean "!="? if self.latest_available_version is not "": /usr/local/share/hplip/ui5/devmgr_ext.py:37: SyntaxWarning: "is not" with a literal. Did you mean "!="? if self.latest_available_version is not "": warning: Fax disabled. warning: Fax disabled. warning: Please install version 2.0+ of Reportlab for coverpage support. error: Fax address book disabled - Python 2.3+ required. Traceback (most recent call last): File "/usr/local/share/hplip/base/password.py", line 85, in get_distro_name os_name = platform.dist()[0] AttributeError: module 'platform' has no attribute 'dist' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/bin/hp-toolbox", line 280, in <module> toolbox = ui.DevMgr5(__version__, device_uri, None) File "/usr/local/share/hplip/ui5/devmgr5.py", line 235, in __init__ core = CoreInstall(MODE_CHECK) File "/usr/local/share/hplip/installer/core_install.py", line 240, in __init__ self.passwordObj = password.Password(ui_mode) File "/usr/local/share/hplip/base/password.py", line 118, in __init__ self.__readAuthType() # self.__authType File "/usr/local/share/hplip/base/password.py", line 141, in __readAuthType distro_name = get_distro_name().lower().replace(" ","") File "/usr/local/share/hplip/base/password.py", line 87, in get_distro_name import distro ModuleNotFoundError: No module named 'distro' Thank you.
(In reply to lumiwa from comment #2) I changed what I was proposing - 'platform.libc_ver()[0]' to 'platform.system()', but since I had no response here, I didn’t post that change. Anyway, this is what I have now in /usr/local/share/hplip/base/password.py : $ diff -ruN /usr/local/share/hplip/base/password.py.orig /usr/local/share/hplip/base/password.py --- /usr/local/share/hplip/base/password.py.orig +++ /usr/local/share/hplip/base/password.py @@ -82,7 +82,7 @@ os_name = None try: - os_name = platform.dist()[0] + os_name = platform.system() except AttributeError: import distro os_name = distro.linux_distribution()[0] @@ -104,7 +104,8 @@ os_name = 'suse' elif "arch" in os_name: os_name = 'manjarolinux' - + elif "freebsd" in os_name: + os_name = 'freebsd' return os_name Don’t forget to [/usr/local/share/hplip/base]$ cp password.py password.py.orig And then use this diff for a patch. This is not a perfect solution, some modules are still complaining, but HP Device Manager (hp-toolbox) works.
(In reply to Vladimir Mišev from comment #3) Thank you very much.
Does installing sysutils/py-distro also fix the problem?
(In reply to Tijl Coosemans from comment #5) Installing sysutils/py-distro fixes this problem for me. There is no need to modify 'base/password.py' when 'py38-distro' is installed. What I did: pkg ins sysutils/py-distro pkg del -R hplip rm –r /usr/local/share/hplip/ #to remove leftover .orig etc pkg ins hplip And hp-toolbox is working OK. (I didn’t check this in the clean install env) Thanks! :)
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=982e968ef61a94e0de75d733e9036e5c60afca34 commit 982e968ef61a94e0de75d733e9036e5c60afca34 Author: Tijl Coosemans <tijl@FreeBSD.org> AuthorDate: 2021-08-25 13:29:51 +0000 Commit: Tijl Coosemans <tijl@FreeBSD.org> CommitDate: 2022-03-11 14:49:48 +0000 print/hplip(-plugin): update to 3.22.2 - Convert post-patch to real patches because they are easier to maintain. - Fix a NULL dereference in the scanner backend when D-Bus isn't running. - Depend on sysutils/py-distro to make hp-toolbox (Device Manager) work again. - Upstream switched to Avahi for mDNS support. Rename the SNMP option to NETWORK because it's not just SNMP now. - Don't install some programs related to uninstalling and upgrading of HPLIP and the installation of firmware plugins because they circumvent the package system. - Install icons in share/icons so desktops can choose an appropriate resolution. Portions taken from a patch by Oleg Sidorkin <osidorkin@gmail.com>. PR: 255586, 257034, 257512 print/hplip-plugin/Makefile | 2 +- print/hplip-plugin/distinfo | 6 +- print/hplip/Makefile | 110 ++++++++--------- print/hplip/distinfo | 6 +- print/hplip/files/patch-FindPPD.cpp (new) | 11 ++ print/hplip/files/patch-Makefile.in | 137 +++++++++++---------- print/hplip/files/patch-base_g.py (new) | 29 +++++ print/hplip/files/patch-base_os__utils.py (new) | 11 ++ print/hplip/files/patch-base_queues.py (new) | 11 ++ print/hplip/files/patch-base_utils.py (new) | 17 +++ print/hplip/files/patch-base_validation.py (new) | 11 ++ print/hplip/files/patch-check.py (new) | 35 ++++++ print/hplip/files/patch-common_utils.c (new) | 11 ++ print/hplip/files/patch-configure (new) | 70 +++++++++++ print/hplip/files/patch-doc_index.html (new) | 11 ++ .../files/patch-doc_troubleshooting.html (new) | 46 +++++++ print/hplip/files/patch-fax_backend_hpfax.py (new) | 29 +++++ print/hplip/files/patch-fax_filters_pstotiff (new) | 15 +++ print/hplip/files/patch-hp-uiscan.desktop.in (new) | 14 +++ print/hplip/files/patch-hpdio.py (new) | 11 ++ .../files/patch-hplip-systray.desktop.in (new) | 13 ++ print/hplip/files/patch-hplip.desktop.in (new) | 13 ++ .../files/patch-installer_core__install.py (new) | 11 ++ print/hplip/files/patch-installer_dcheck.py | 4 +- .../files/patch-installer_pluginhandler.py (new) | 56 +++++++++ print/hplip/files/patch-io_hpmud_musb.c | 6 +- print/hplip/files/patch-logcapture.py (new) | 31 +++++ print/hplip/files/patch-prnt_backend_hp.c (new) | 11 ++ print/hplip/files/patch-prnt_cups.py (new) | 88 +++++++++++++ print/hplip/files/patch-prnt_filters_hpps (new) | 20 +++ .../files/patch-prnt_hpcups_CommonDefinitions.h | 2 +- .../hplip/files/patch-prnt_hpcups_ErnieFilter.cpp | 2 +- .../hplip/files/patch-prnt_hpcups_HPCupsFilter.cpp | 74 +++-------- .../patch-prnt_hpcups_SystemServices.cpp (new) | 11 ++ .../files/patch-prnt_hpcups_genJPEGStrips.cpp | 2 +- .../files/patch-prnt_hpijs_hpcupsfax.cpp (new) | 20 +++ print/hplip/files/patch-prnt_hpps_hppsfilter.c | 13 +- .../files/patch-protocol_discovery_mdns.c (gone) | 86 ------------- .../patch-scan_sane_OrbliteScan_BSDCommon.h (gone) | 63 ---------- ...patch-scan_sane_OrbliteScan_LinuxCommon.h (new) | 13 ++ .../files/patch-scan_sane_OrbliteScan_MacCommon.h | 19 ++- print/hplip/files/patch-scan_sane_hpaio.c | 24 ++-- print/hplip/files/patch-scan_sane_io.c (new) | 14 +++ print/hplip/files/patch-scan_sane_orblite.c | 2 +- print/hplip/files/patch-ui5_devmgr5.py (new) | 11 ++ print/hplip/files/patch-ui5_scandialog.py (new) | 23 ++++ print/hplip/pkg-descr | 11 +- print/hplip/pkg-plist | 74 ++++++++--- 48 files changed, 910 insertions(+), 400 deletions(-)