diff --git a/hplip-use-raw-strings.patch b/hplip-use-raw-strings.patch index f3b5495..afef121 100644 --- a/hplip-use-raw-strings.patch +++ b/hplip-use-raw-strings.patch @@ -1,3 +1,16 @@ +diff --git a/base/LedmWifi.py b/base/LedmWifi.py +index f63a050..074d5a2 100644 +--- a/base/LedmWifi.py ++++ b/base/LedmWifi.py +@@ -31,7 +31,7 @@ from .g import * + from . import device, utils + from .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) + HTTP_OK = 200 + HTTP_ACCEPTED = 202 + HTTP_NOCONTENT = 204 diff --git a/base/device.py b/base/device.py index fbe6c34..a551403 100644 --- a/base/device.py @@ -124,6 +137,28 @@ index 259bf82..a4ed107 100644 self.__password_prompt_str = cb try: +diff --git a/base/queues.py b/base/queues.py +index 0818574..8625f53 100755 +--- 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) +@@ -149,7 +149,7 @@ def parseQueues(mode): + desc='' + else: + try: +- desc = to_string_utf8( NICKNAME_PATTERN.search(fileptr).group(1) ) ++ desc = to_string_utf8( NICKNAME_PATTERN.search(fileptr.decode('utf-8')).group(1) ) + except AttributeError: + desc = '' + diff --git a/base/status.py b/base/status.py index 37c774e..01f455d 100644 --- a/base/status.py @@ -215,6 +250,41 @@ index 2b631ce..2fb57c4 100644 try: while cnt or --port= (Valid values are 1\*, 2, and 3. \*default)", "option", False), ++ ("To specify the port on a multi-port JetDirect:", r"-p or --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), diff --git a/prnt/cups.py b/prnt/cups.py index 1ea3099..78b8adc 100644 --- a/prnt/cups.py @@ -270,8 +353,33 @@ index 2041fb6..2b43ece 100755 ("Search:", "-s or --search=", "option", False), ("", " must be a valid regular expression (not case sensitive)", "option", False), ("Network discovery method:", "-m or --method=: is 'slp'* or 'mdns'.", "option", False), +diff --git a/scan.py b/scan.py +index 0bfa6f5..27b8c2e 100755 +--- a/scan.py ++++ b/scan.py +@@ -249,9 +249,9 @@ try: + extra_options=[utils.USAGE_SPACE, + ("[OPTIONS] (General)", "", "header", False), + ("Scan destinations:", "-s or --dest=", "option", False), +- ("", "where is a comma separated list containing one or more of: 'file'\*, ", "option", False), ++ ("", r"where 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 or --mode=. Where is 'gray'\*, 'color' or 'lineart'.", "option", False), ++ ("Scan mode:", r"-m or --mode=. Where is 'gray'\*, 'color' or 'lineart'.", "option", False), + ("Scanning resolution:", "-r or --res= or --resolution=", "option", False), + ("", "where 300 is default.", "option", False), + ("Image resize:", "--resize= (min=1%, max=400%, default=100%)", "option", False), +@@ -268,7 +268,7 @@ try: + utils.USAGE_SPACE, + ("[OPTIONS] (Scan area)", "", "header", False), + ("Specify the units for area/box measurements:", "-t or --units=", "option", False), +- ("", "where is 'mm'\*, 'cm', 'in', 'px', or 'pt' ('mm' is default).", "option", False), ++ ("", r"where is 'mm'\*, 'cm', 'in', 'px', or 'pt' ('mm' is default).", "option", False), + ("Scan area:", "-a,,, or --area=,,,", "option", False), + ("", "Coordinates are relative to the upper left corner of the scan area.", "option", False), + ("", "Units for tlx, tly, brx, and bry are specified by -t/--units (default is 'mm').", "option", False), diff --git a/setup.py b/setup.py -index 98f57fd..539be50 100755 +index 98f57fd..1a74d6d 100755 --- a/setup.py +++ b/setup.py @@ -79,11 +79,11 @@ USAGE = [ (__doc__, "", "name", True), @@ -279,12 +387,34 @@ index 98f57fd..539be50 100755 utils.USAGE_OPTIONS, ("Automatic mode:", "-a or --auto (-i mode only)", "option", False), - ("To specify the port on a multi-port JetDirect:", "--port= (Valid values are 1\*, 2, and 3. \*default)", "option", False), -+ (r"To specify the port on a multi-port JetDirect:", "--port= (Valid values are 1\*, 2, and 3. \*default)", "option", False), ++ ("To specify the port on a multi-port JetDirect:", r"--port= (Valid values are 1\*, 2, and 3. \*default)", "option", False), ("No testpage in automatic mode:", "-x (-i mode only)", "option", False), ("To specify a CUPS printer queue name:", "-p or --printer= (-i mode only)", "option", False), ("To specify a CUPS fax queue name:", "-f or --fax= (-i mode only)", "option", False), - ("Type of queue(s) to install:", "-t or --type=. : print*, fax\* (\*default) (-i mode only)", "option", False), -+ (r"Type of queue(s) to install:", "-t or --type=. : print*, fax\* (\*default) (-i mode only)", "option", False), ++ ("Type of queue(s) to install:", r"-t or --type=. : print*, fax\* (\*default) (-i mode only)", "option", False), ("To specify the device URI to install:", "-d or --device= (--qt4 mode only)", "option", False), ("Remove printers or faxes instead of setting-up:", "-r or --rm or --remove", "option", False), utils.USAGE_LANGUAGE, +diff --git a/ui5/devmgr_ext.py b/ui5/devmgr_ext.py +index 34b4977..6b7a61e 100644 +--- a/ui5/devmgr_ext.py ++++ b/ui5/devmgr_ext.py +@@ -12,7 +12,7 @@ class Ui_MainWindow_Derived(object): + + self.latest_available_version = latest_available_version + self.Is_autoInstaller_distro = Is_autoInstaller_distro +- if self.latest_available_version is not "": ++ if self.latest_available_version != "": + self.tab_3 = QWidget() + self.tab_3.setObjectName("tab_3") + self.label = QLabel(self.tab_3) +@@ -34,7 +34,7 @@ class Ui_MainWindow_Derived(object): + + def retranslateUi(self, MainWindow): + super(Ui_MainWindow_Derived, self).retranslateUi(MainWindow) +- if self.latest_available_version is not "": ++ if self.latest_available_version != "": + self.label.setText(QApplication.translate("MainWindow", "New version of HPLIP-%s is available"%self.latest_available_version, None)) + self.Tabs.setTabText(self.Tabs.indexOf(self.tab_3), QApplication.translate("MainWindow", "Upgrade", None)) + if self.Is_autoInstaller_distro: