SyntaxWarnings with Python3.12

Bug #2029480 reported by zdohnal
54
This bug affects 9 people
Affects Status Importance Assigned to Milestone
HPLIP
Confirmed
Undecided
Unassigned
hplip (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Fedora 39 uses Python 3.12 by default, which generates many SyntaxWarnings when running hplip scripts.

Most warnings are due regular expressions in strings, so making them raw fixes the issue.

The patch is attached.

Tags: patch
Revision history for this message
zdohnal (zdohnal) wrote :
Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

@zdohnal, thanks a lot for the patch, I have applied it now (with slight adjustments) to the Ubuntu package, fixing bug #2054869.

Changed in hplip (Ubuntu):
status: New → Fix Committed
Changed in hplip:
status: New → Confirmed
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Proposed patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
zdohnal (zdohnal) wrote :

Till,

in case there is an issue within my patch which made you do the adjustments, would you mind sharing them here? Upstream can apply them later together with all changes.

Revision history for this message
Till Kamppeter (till-kamppeter) wrote :

This is the patch adapted to the actual Ubuntu/Debian package of HPLIP, as used in the hplip 3.23.12+dfsg0-0ubuntu2 release for Noble.

The adaptations were most probably needed because, before applying this patch ~80 other patches got applied to the original source code of HPLIP.

Especially the transition from "is not" to "!=" seems already done.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package hplip - 3.23.12+dfsg0-0ubuntu4

---------------
hplip (3.23.12+dfsg0-0ubuntu4) noble; urgency=medium

  * Fix FTBFS on armhf due to implicit functions

 -- Simon Chopin <email address hidden> Fri, 22 Mar 2024 15:40:13 +0100

Changed in hplip (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
fprietog (fprietog) wrote (last edit ):

I'm sorry but the related fix seem to be not complete: during upgrade from 23.10.1 mantic to 24.04 noble it updates hplip-data 3.23.12+dfsg0-0ubuntu5 from previous 3.22.10+dfsg0-2ubuntu1 and it doesn't generate SyntaxWarnings... but a few moments later, then during python3 (3.12.3-0ubuntu1) configuration:

Configurando python3 (3.12.3-0ubuntu1) ...
running python rtupdate hooks for python3.12...
...
/usr/share/hplip/base/imagesize.py:186: SyntaxWarning: invalid escape sequence '\#'
  re.compile('\#define\s+\S+\s+\d+') : ('image/x-xbitmap', xbmsize),
/usr/share/hplip/base/imagesize.py:187: SyntaxWarning: invalid escape sequence '\/'
  re.compile('\/\* XPM \*\/') : ('image/x-xpixmap', xpmsize),
/usr/share/hplip/base/imagesize.py:189: SyntaxWarning: invalid escape sequence '\*'
  re.compile('^II\*\x00') : ('image/tiff', tiffsize),
/usr/share/hplip/fax/ledmfax.py:46: SyntaxWarning: invalid escape sequence '\d'
  http_result_pat = re.compile(b"""HTTP/\d.\d\s(\d+)""", re.I)
...
running python post-rtupdate hooks for python3.12...

You can also reinstall hplip-data using apt and ending in the same problem:

# apt install --reinstall hplip-data
Leyendo lista de paquetes... Hecho
Creando árbol de dependencias... Hecho
Leyendo la información de estado... Hecho
0 actualizados, 0 nuevos se instalarán, 1 reinstalados, 0 para eliminar y 0 no actualizados.
Se necesita descargar 6.467 kB de archivos.
Se utilizarán 0 B de espacio de disco adicional después de esta operación.
Des:1 http://ports.ubuntu.com/ubuntu-ports noble/main arm64 hplip-data all 3.23.12+dfsg0-0ubuntu5 [6.467 kB]
Descargados 6.467 kB en 1s (8.035 kB/s)
(Leyendo la base de datos ... 221724 ficheros o directorios instalados actualmente.)
Preparando para desempaquetar .../hplip-data_3.23.12+dfsg0-0ubuntu5_all.deb ...
Desempaquetando hplip-data (3.23.12+dfsg0-0ubuntu5) sobre (3.23.12+dfsg0-0ubuntu5) ...
Configurando hplip-data (3.23.12+dfsg0-0ubuntu5) ...
/usr/share/hplip/base/imagesize.py:186: SyntaxWarning: invalid escape sequence '\#'
  re.compile('\#define\s+\S+\s+\d+') : ('image/x-xbitmap', xbmsize),
/usr/share/hplip/base/imagesize.py:187: SyntaxWarning: invalid escape sequence '\/'
  re.compile('\/\* XPM \*\/') : ('image/x-xpixmap', xpmsize),
/usr/share/hplip/base/imagesize.py:189: SyntaxWarning: invalid escape sequence '\*'
  re.compile('^II\*\x00') : ('image/tiff', tiffsize),
/usr/share/hplip/fax/ledmfax.py:46: SyntaxWarning: invalid escape sequence '\d'
  http_result_pat = re.compile(b"""HTTP/\d.\d\s(\d+)""", re.I)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.