On Thu, Jul 11, 2024 at 09:39:56PM +0200, Till Kamppeter wrote:
> I ran into the same problem at Ubuntu. See the hplip 3.23.12+dfsg0-0ubuntu4
> package in Ubuntu 24.04 (Noble Numbat). We have added the patch
> 
> debian/patches/0086-hplip-use-raw-strings.patch
> 
> here which marks the strings as raw strings. This should be ported over to 
> Debian.
> 
> Also please check the newest upstream version of HPLIP, once it can have
> this already fixed and second, it makes generally sense to use the newest
> version ...

Hi all,

Thanks for uploading hplip 3.26.4. Seems that there are still some
warnings about these sequences.

See attached patch for some suggestions, based on changes by Till
and others.

-- 
Agustin
From: Till Kamppeter <[email protected]>
Date: Wed, 30 Apr 2025 00:15:23 +0200
Subject: Use raw strings to deal with complaints about invalid escapes.

---
 base/LedmWifi.py    |  2 +-
 base/device.py      |  2 +-
 base/g.py           |  4 ++--
 base/imagesize.py   |  6 +++---
 base/logger.py      |  6 +++---
 base/models.py      | 40 ++++++++++++++++++++--------------------
 base/password.py    |  4 ++--
 base/queues.py      |  4 ++--
 base/status.py      |  2 +-
 base/tui.py         |  2 +-
 base/utils.py       | 14 +++++++-------
 check.py            |  2 +-
 fax/ledmfax.py      |  2 +-
 fax/soapfax.py      |  2 +-
 installer/dcheck.py |  6 +++---
 makeuri.py          |  2 +-
 prnt/cups.py        |  2 +-
 probe.py            |  4 ++--
 scan.py             |  6 +++---
 setup.py            |  4 ++--
 20 files changed, 58 insertions(+), 58 deletions(-)

--- a/base/imagesize.py
+++ b/base/imagesize.py
@@ -183,10 +183,10 @@ TYPE_MAP = {re.compile('^GIF8[7,9]a')
              re.compile("^\xFF\xD8")                : ('image/jpeg', jpegsize),
              re.compile("^\x89PNG\x0d\x0a\x1a\x0a") : ('image/png', pngsize),
              re.compile("^P[1-7]")                  : ('image/x-portable-pixmap', ppmsize),
-             re.compile('\#define\s+\S+\s+\d+')     : ('image/x-xbitmap', xbmsize),
-             re.compile('\/\* XPM \*\/')            : ('image/x-xpixmap', xpmsize),
+             re.compile(r'#define\s+\S+\s+\d+')     : ('image/x-xbitmap', xbmsize),
+             re.compile(r'/\* XPM \*/')             : ('image/x-xpixmap', xpmsize),
              re.compile('^MM\x00\x2a')              : ('image/tiff', tiffsize),
-             re.compile('^II\*\x00')                : ('image/tiff', tiffsize),
+             re.compile('^II\\*\x00')               : ('image/tiff', tiffsize),
              re.compile('^BM')                      : ('image/x-bitmap', bmpsize),
              re.compile("^\x8aMNG\x0d\x0a\x1a\x0a") : ('image/png', pngsize),
            }
--- a/base/queues.py
+++ b/base/queues.py
@@ -46,7 +46,7 @@ HPPS = 3
 HPOTHER = 4
 
 DEVICE_URI_PATTERN = re.compile(r"""(.*):/(.*?)/(\S*?)\?(?:serial=(\S*)|device=(\S*)|ip=(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}[^&]*)|zc=(\S+))(?:&port=(\d))?""", re.I)
-NICKNAME_PATTERN = re.compile(b'''\*NickName:\s*\"(.*)"''', re.MULTILINE)
+NICKNAME_PATTERN = re.compile(r'''\*NickName:\s*\"(.*)"''', re.MULTILINE)
 NET_PATTERN = re.compile(r"""(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})""")
 NET_ZC_PATTERN = re.compile(r'''zc=(.*)''',re.IGNORECASE)
 NET_OTHER_PATTERN = re.compile(r'''(.*)://(.*)''',re.IGNORECASE)
--- a/check.py
+++ b/check.py
@@ -627,7 +627,7 @@ class DependenciesCheck(object):
                     status, output = utils.run("%s -d03f0:" % lsusb)
 
                     if output:
-                        lsusb_pat = re.compile("""^Bus\s([0-9a-fA-F]{3,3})\sDevice\s([0-9a-fA-F]{3,3}):\sID\s([0-9a-fA-F]{4,4}):([0-9a-fA-F]{4,4})(.*)""", re.IGNORECASE)
+                        lsusb_pat = re.compile(r"""^Bus\s([0-9a-fA-F]{3,3})\sDevice\s([0-9a-fA-F]{3,3}):\sID\s([0-9a-fA-F]{4,4}):([0-9a-fA-F]{4,4})(.*)""", re.IGNORECASE)
                         log.debug(output)
                         try:
                             hpmudext = utils.import_ext('hpmudext')
--- a/fax/ledmfax.py
+++ b/fax/ledmfax.py
@@ -43,7 +43,7 @@ from .fax import *
 
 # **************************************************************************** #
 
-http_result_pat = re.compile(b"""HTTP/\d.\d\s(\d+)""", re.I)
+http_result_pat = re.compile(r"HTTP/\d.\d\s(\d+)", re.I)
 
 HTTP_OK = 200
 HTTP_ACCEPTED = 202
--- a/fax/soapfax.py
+++ b/fax/soapfax.py
@@ -42,7 +42,7 @@ from base.sixext import to_bytes_utf8
 
 # **************************************************************************** #
 
-http_result_pat = re.compile("""HTTP/\d.\d\s(\d+)""", re.I)
+http_result_pat = re.compile(r"""HTTP/\d.\d\s(\d+)""", re.I)
 
 
 TIME_FORMAT_AM_PM = 1
--- a/makeuri.py
+++ b/makeuri.py
@@ -46,7 +46,7 @@ USAGE = [ (__doc__, "", "name", True),
           ("DEVNODE (parallel only):", '"/dev/parportX", X=0,1,2,...', "option", False),
           ("SERIAL NO. (usb and parallel only):", '"serial no."', "option", True),
           utils.USAGE_OPTIONS,
-          ("To specify the port on a multi-port JetDirect:", "-p<port> or --port=<port> (Valid values are 1\*, 2, and 3. \*default)", "option", False),
+          ("To specify the port on a multi-port JetDirect:", r"-p<port> or --port=<port> (Valid values are 1\*, 2, and 3. \*default)", "option", False),
           ("Show the CUPS URI only (quiet mode):", "-c or --cups", "option", False),
           ("Show the SANE URI only (quiet mode):", "-s or --sane", "option", False),
           ("Show the HP Fax URI only (quiet mode):", "-f or --fax", "option", False),
--- a/probe.py
+++ b/probe.py
@@ -42,11 +42,11 @@ USAGE = [(__doc__, "", "name", True),
          ("Usage: %s [OPTIONS]" % __mod__, "", "summary", True),
          utils.USAGE_OPTIONS,
          ("Bus to probe:", "-b<bus> or --bus=<bus>", "option", False),
-         ("", "<bus>: cups, usb\*, net, bt, fw, par (\*default) (Note: bt and fw not supported in this release.)", "option", False),
+         ("", r"<bus>: cups, usb\*, net, bt, fw, par (\*default) (Note: bt and fw not supported in this release.)", "option", False),
          ("Set Time to Live (TTL):", "-t<ttl> or --ttl=<ttl> (Default is 4).", "option", False),
          ("Set timeout:", "-o<timeout in secs.> or --timeout=<timeout is secs.>", "option", False),
          ("Filter by functionality:", "-e<filter list> or --filter=<filter list>", "option", False),
-         ("", "<filter list>: comma separated list of one or more of: scan, pcard, fax, copy, or none\*. (\*none is the default)", "option", False),
+         ("", r"<filter list>: comma separated list of one or more of: scan, pcard, fax, copy, or none\*. (\*none is the default)", "option", False),
          ("Search:", "-s<search re> or --search=<search re>", "option", False),
          ("", "<search re> must be a valid regular expression (not case sensitive)", "option", False),
          ("Network discovery method:", "-m<method> or --method=<method>: <method> is 'slp'* or 'mdns'.", "option", False),
--- a/scan.py
+++ b/scan.py
@@ -281,7 +281,7 @@ try:
         ("Scan destinations:", "-s<dest_list> or --dest=<dest_list>", "option", False),
         ("", "where <dest_list> is a comma separated list containing one or more of: 'file'", "option", False),
         ("", ", 'viewer', 'editor', 'pdf', or 'print'. Use only commas between values, no spaces.", "option", False),
-        ("Scan mode:", "-m<mode> or --mode=<mode>. Where <mode> is 'gray'\*, 'color' or 'lineart'.", "option", False),
+        ("Scan mode:", r"-m<mode> or --mode=<mode>. Where <mode> is 'gray'\*, 'color' or 'lineart'.", "option", False),
         ("Scanning resolution:", "-r<resolution_in_dpi> or --res=<resolution_in_dpi> or --resolution=<resolution_in_dpi>", "option", False),
         ("", "where 300 is default.", "option", False),
         ("Image resize:", "--resize=<scale_in_%> (min=1%, max=400%, default=100%)", "option", False),

Reply via email to