Bug#878434: python-debian: Python 3.6 invalid escape sequence deprecation fixes

Ville Skyttä ville.skytta at iki.fi
Fri Oct 13 17:32:53 UTC 2017


Package: python-debian
Version: 0.1.30
Severity: minor

Dear Maintainer,

'git am'able patch containing Python 3.6 invalid escape sequence
deprecation fixes is attached.

https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior

-- System Information:
Debian Release: stretch/sid
  APT prefers artful
  APT policy: (500, 'artful')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.13.0-15-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages python-debian depends on:
ii  python          2.7.14-2ubuntu1
ii  python-chardet  3.0.4-1
ii  python-six      1.10.0-4

Versions of packages python-debian recommends:
ii  python-apt  1.4.0~beta3build2

Versions of packages python-debian suggests:
ii  gpgv  2.1.15-1ubuntu7

-- no debconf information
-------------- next part --------------
>From e7d9998c38c760c4790ba5a2a8025282b633d33f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ville=20Skytt=C3=A4?= <ville.skytta at iki.fi>
Date: Fri, 13 Oct 2017 20:31:03 +0300
Subject: [PATCH] Python 3.6 invalid escape sequence deprecation fixes

https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior
---
 lib/debian/changelog.py      | 52 ++++++++++++++++++++++----------------------
 lib/debian/deb822.py         |  2 +-
 lib/debian/debian_support.py |  8 +++----
 3 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/lib/debian/changelog.py b/lib/debian/changelog.py
index 1a1debc..81a34a9 100644
--- a/lib/debian/changelog.py
+++ b/lib/debian/changelog.py
@@ -145,7 +145,7 @@ class ChangeBlock(object):
         bugs = []
         for match in type_re.finditer(changes):
             closes_list = match.group(0)
-            for match in re.finditer("\d+", closes_list):
+            for match in re.finditer(r"\d+", closes_list):
                 bugs.append(int(match.group(0)))
         return bugs
 
@@ -202,42 +202,42 @@ class ChangeBlock(object):
             return unicode(self).encode(self._encoding)
 
 topline = re.compile(r'^(\w%(name_chars)s*) \(([^\(\) \t]+)\)'
-                     '((\s+%(name_chars)s+)+)\;'
+                     r'((\s+%(name_chars)s+)+)\;'
                      % {'name_chars': '[-+0-9a-z.]'},
                      re.IGNORECASE)
-blankline = re.compile('^\s*$')
-change = re.compile('^\s\s+.*$')
-endline = re.compile('^ -- (.*) <(.*)>(  ?)((\w+\,\s*)?\d{1,2}\s+\w+\s+'
-            '\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}\s*)$')
-endline_nodetails = re.compile('^ --(?: (.*) <(.*)>(  ?)((\w+\,\s*)?\d{1,2}'
-                '\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}'
-                '))?\s*$')
-keyvalue= re.compile('^([-0-9a-z]+)=\s*(.*\S)$', re.IGNORECASE)
-value_re = re.compile('^([-0-9a-z]+)((\s+.*)?)$', re.IGNORECASE)
+blankline = re.compile(r'^\s*$')
+change = re.compile(r'^\s\s+.*$')
+endline = re.compile(r'^ -- (.*) <(.*)>(  ?)((\w+\,\s*)?\d{1,2}\s+\w+\s+'
+            r'\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}\s*)$')
+endline_nodetails = re.compile(r'^ --(?: (.*) <(.*)>(  ?)((\w+\,\s*)?\d{1,2}'
+                r'\s+\w+\s+\d{4}\s+\d{1,2}:\d\d:\d\d\s+[-+]\d{4}'
+                r'))?\s*$')
+keyvalue= re.compile(r'^([-0-9a-z]+)=\s*(.*\S)$', re.IGNORECASE)
+value_re = re.compile(r'^([-0-9a-z]+)((\s+.*)?)$', re.IGNORECASE)
 xbcs_re = re.compile('^X[BCS]+-', re.IGNORECASE)
-emacs_variables = re.compile('^(;;\s*)?Local variables:', re.IGNORECASE)
+emacs_variables = re.compile(r'^(;;\s*)?Local variables:', re.IGNORECASE)
 vim_variables = re.compile('^vim:', re.IGNORECASE)
-cvs_keyword = re.compile('^\$\w+:.*\$')
-comments = re.compile('^\# ')
-more_comments = re.compile('^/\*.*\*/')
-closes = re.compile('closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*',
+cvs_keyword = re.compile(r'^\$\w+:.*\$')
+comments = re.compile(r'^\# ')
+more_comments = re.compile(r'^/\*.*\*/')
+closes = re.compile(r'closes:\s*(?:bug)?\#?\s?\d+(?:,\s*(?:bug)?\#?\s?\d+)*',
                     re.IGNORECASE)
-closeslp = re.compile('lp:\s+\#\d+(?:,\s*\#\d+)*', re.IGNORECASE)
+closeslp = re.compile(r'lp:\s+\#\d+(?:,\s*\#\d+)*', re.IGNORECASE)
 
-old_format_re1 = re.compile('^(\w+\s+\w+\s+\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}'
-        '\s+[\w\s]*\d{4})\s+(.*)\s+(<|\()(.*)(\)|>)')
-old_format_re2 = re.compile('^(\w+\s+\w+\s+\d{1,2},?\s*\d{4})\s+(.*)'
-        '\s+(<|\()(.*)(\)|>)')
-old_format_re3 = re.compile('^(\w[-+0-9a-z.]*) \(([^\(\) \t]+)\)\;?',
+old_format_re1 = re.compile(r'^(\w+\s+\w+\s+\d{1,2} \d{1,2}:\d{1,2}:\d{1,2}'
+        r'\s+[\w\s]*\d{4})\s+(.*)\s+(<|\()(.*)(\)|>)')
+old_format_re2 = re.compile(r'^(\w+\s+\w+\s+\d{1,2},?\s*\d{4})\s+(.*)'
+        r'\s+(<|\()(.*)(\)|>)')
+old_format_re3 = re.compile(r'^(\w[-+0-9a-z.]*) \(([^\(\) \t]+)\)\;?',
         re.IGNORECASE)
-old_format_re4 = re.compile('^([\w.+-]+)(-| )(\S+) Debian (\S+)',
+old_format_re4 = re.compile(r'^([\w.+-]+)(-| )(\S+) Debian (\S+)',
         re.IGNORECASE)
 old_format_re5 = re.compile('^Changes from version (.*) to (.*):',
         re.IGNORECASE)
-old_format_re6 = re.compile('^Changes for [\w.+-]+-[\w.+-]+:?\s*$',
+old_format_re6 = re.compile(r'^Changes for [\w.+-]+-[\w.+-]+:?\s*$',
         re.IGNORECASE)
-old_format_re7 = re.compile('^Old Changelog:\s*$', re.IGNORECASE)
-old_format_re8 = re.compile('^(?:\d+:)?\w[\w.+~-]*:?\s*$')
+old_format_re7 = re.compile(r'^Old Changelog:\s*$', re.IGNORECASE)
+old_format_re8 = re.compile(r'^(?:\d+:)?\w[\w.+~-]*:?\s*$')
 
 
 class Changelog(object):
diff --git a/lib/debian/deb822.py b/lib/debian/deb822.py
index 26f4b68..ab4d41c 100644
--- a/lib/debian/deb822.py
+++ b/lib/debian/deb822.py
@@ -643,7 +643,7 @@ class Deb822(Deb822Dict):
         gpgre = re.compile(br'^-----(?P<action>BEGIN|END) PGP (?P<what>[^-]+)-----[\r\t ]*$')
         # Include whitespace-only lines in blank lines to split paragraphs.
         # (see #715558)
-        blank_line = re.compile(b'^\s*$')
+        blank_line = re.compile(br'^\s*$')
         first_line = True
 
         for line in sequence:
diff --git a/lib/debian/debian_support.py b/lib/debian/debian_support.py
index 143f8a9..9e56d8c 100644
--- a/lib/debian/debian_support.py
+++ b/lib/debian/debian_support.py
@@ -220,9 +220,9 @@ class AptPkgVersion(BaseVersion):
 class NativeVersion(BaseVersion):
     """Represents a Debian package version, with native Python comparison"""
 
-    re_all_digits_or_not = re.compile("\d+|\D+")
-    re_digits = re.compile("\d+")
-    re_digit = re.compile("\d")
+    re_all_digits_or_not = re.compile(r"\d+|\D+")
+    re_digits = re.compile(r"\d+")
+    re_digit = re.compile(r"\d")
     re_alpha = re.compile("[A-Za-z]")
 
     def _compare(self, other):
@@ -595,7 +595,7 @@ def update_file(remote, local, verbose=None):
     import urllib
     index_name = remote + '.diff/Index'
 
-    re_whitespace=re.compile('\s+')
+    re_whitespace=re.compile(r'\s+')
 
     try:
         index_url = urllib.urlopen(index_name)
-- 
2.14.1



More information about the pkg-python-debian-maint mailing list