launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25733
[Merge] ~cjwatson/launchpad:py3-soyuz-raw-strings into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:py3-soyuz-raw-strings into launchpad:master.
Commit message:
Correct spelling of \-escapes in lp.soyuz and friends
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/394428
This fixes a number of DeprecationWarnings with Python >= 3.6.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:py3-soyuz-raw-strings into launchpad:master.
diff --git a/lib/lp/archivepublisher/tests/test_signing.py b/lib/lp/archivepublisher/tests/test_signing.py
index b4abc0e..c5b1a91 100644
--- a/lib/lp/archivepublisher/tests/test_signing.py
+++ b/lib/lp/archivepublisher/tests/test_signing.py
@@ -746,7 +746,7 @@ class TestLocalSigningUpload(RunPartsMixin, TestSigningHelpers):
text = upload.generateOpensslConfig('Kmod', upload.openssl_config_kmod)
id_re = re.compile(r'^# KMOD OpenSSL config\n')
- cn_re = re.compile(r'\bCN\s*=\s*' + self.testcase_cn + '\s+Kmod')
+ cn_re = re.compile(r'\bCN\s*=\s*' + self.testcase_cn + r'\s+Kmod')
eku_re = re.compile(
r'\bextendedKeyUsage\s*=\s*'
r'codeSigning,1.3.6.1.4.1.2312.16.1.2\s*\b')
@@ -832,7 +832,7 @@ class TestLocalSigningUpload(RunPartsMixin, TestSigningHelpers):
text = upload.generateOpensslConfig('Opal', upload.openssl_config_opal)
id_re = re.compile(r'^# OPAL OpenSSL config\n')
- cn_re = re.compile(r'\bCN\s*=\s*' + self.testcase_cn + '\s+Opal')
+ cn_re = re.compile(r'\bCN\s*=\s*' + self.testcase_cn + r'\s+Opal')
self.assertIn('[ req ]', text)
self.assertIsNotNone(id_re.search(text))
@@ -915,7 +915,7 @@ class TestLocalSigningUpload(RunPartsMixin, TestSigningHelpers):
text = upload.generateOpensslConfig('SIPL', upload.openssl_config_sipl)
id_re = re.compile(r'^# SIPL OpenSSL config\n')
- cn_re = re.compile(r'\bCN\s*=\s*' + self.testcase_cn + '\s+SIPL')
+ cn_re = re.compile(r'\bCN\s*=\s*' + self.testcase_cn + r'\s+SIPL')
self.assertIn('[ req ]', text)
self.assertIsNotNone(id_re.search(text))
diff --git a/lib/lp/archiveuploader/tests/test_changesfile.py b/lib/lp/archiveuploader/tests/test_changesfile.py
index 492eb50..18d6a7b 100644
--- a/lib/lp/archiveuploader/tests/test_changesfile.py
+++ b/lib/lp/archiveuploader/tests/test_changesfile.py
@@ -377,7 +377,7 @@ class TestSignatureVerification(TestCase):
self.assertEqual(
getUtility(IPersonSet).getByEmail('foo.bar@xxxxxxxxxxxxx'),
changesfile.signer)
- expected = "\AFormat: 1.7\n.*foo_1.0-1.diff.gz\Z"
+ expected = r"\AFormat: 1.7\n.*foo_1.0-1.diff.gz\Z"
self.assertTextMatchesExpressionIgnoreWhitespace(
expected,
changesfile.parsed_content)
@@ -399,7 +399,7 @@ class TestSignatureVerification(TestCase):
self.assertEqual(
getUtility(IPersonSet).getByEmail('foo.bar@xxxxxxxxxxxxx'),
changesfile.signer)
- expected = "\AFormat: 1.7\n.*foo_1.0-1.diff.gz\Z"
+ expected = r"\AFormat: 1.7\n.*foo_1.0-1.diff.gz\Z"
self.assertTextMatchesExpressionIgnoreWhitespace(
expected,
changesfile.parsed_content)
diff --git a/lib/lp/archiveuploader/utils.py b/lib/lp/archiveuploader/utils.py
index 67a009f..8b4cf73 100644
--- a/lib/lp/archiveuploader/utils.py
+++ b/lib/lp/archiveuploader/utils.py
@@ -72,8 +72,8 @@ re_isadeb = re.compile(r"(.+?)_(.+?)_(.+)\.(u?d?deb)$")
re_isbuildinfo = re.compile(r"(.+?)_(.+?)_(.+)\.buildinfo$")
source_file_exts = [
- 'orig(?:-.+)?\.tar\.(?:gz|bz2|xz)(?:\.asc)?', 'diff.gz',
- '(?:debian\.)?tar\.(?:gz|bz2|xz)', 'dsc']
+ r'orig(?:-.+)?\.tar\.(?:gz|bz2|xz)(?:\.asc)?', 'diff.gz',
+ r'(?:debian\.)?tar\.(?:gz|bz2|xz)', 'dsc']
re_issource = re.compile(
r"([^_]+)_(.+?)\.(%s)" % "|".join(ext for ext in source_file_exts))
re_is_component_orig_tar_ext = re.compile(r"^orig-(.+).tar.(?:gz|bz2|xz)$")
diff --git a/lib/lp/soyuz/browser/tests/test_archive_packages.py b/lib/lp/soyuz/browser/tests/test_archive_packages.py
index c18024b..3bbff33 100644
--- a/lib/lp/soyuz/browser/tests/test_archive_packages.py
+++ b/lib/lp/soyuz/browser/tests/test_archive_packages.py
@@ -385,7 +385,7 @@ class TestPPAPackagesJobNotifications(TestCaseWithFactory):
# Check the presence of the link to remove the notification.
soupmatchers.Tag(
'no remove notification link', 'a',
- text=re.compile('\s*Remove notification\s*'),
+ text=re.compile(r'\s*Remove notification\s*'),
attrs={'class': re.compile('remove-notification')}),
# Check the presence of the error message.
soupmatchers.Tag(
@@ -406,7 +406,7 @@ class TestPPAPackagesJobNotifications(TestCaseWithFactory):
# Check the absence of the link remove the notification.
soupmatchers.Tag(
'no remove notification link', 'a',
- text=re.compile('\s*Remove notification\s*'),
+ text=re.compile(r'\s*Remove notification\s*'),
attrs={'class': re.compile('remove-notification')}),
)
self.assertThat(html, Not(packages_not_matches))
@@ -431,7 +431,7 @@ class TestPPAPackagesJobNotifications(TestCaseWithFactory):
# Check the absence of the link remove the notification.
soupmatchers.Tag(
'remove notification link', 'a',
- text=re.compile('\s*Remove notification\s*'),
+ text=re.compile(r'\s*Remove notification\s*'),
attrs={'class': re.compile('remove-notification')}),
)
self.assertThat(html, packages_matches)
diff --git a/lib/lp/soyuz/browser/tests/test_livefs.py b/lib/lp/soyuz/browser/tests/test_livefs.py
index fc6076c..8216674 100644
--- a/lib/lp/soyuz/browser/tests/test_livefs.py
+++ b/lib/lp/soyuz/browser/tests/test_livefs.py
@@ -459,7 +459,7 @@ class TestLiveFSView(BrowserTestCase):
build = self.makeBuild(
status=BuildStatus.FULLYBUILT, duration=timedelta(minutes=30))
build.setLog(self.factory.makeLibraryFileAlias())
- self.assertTextMatchesExpressionIgnoreWhitespace("""\
+ self.assertTextMatchesExpressionIgnoreWhitespace(r"""\
Latest builds
Status When complete Architecture Archive
Successfully built 30 minutes ago buildlog \(.*\) i386
@@ -486,7 +486,7 @@ class TestLiveFSView(BrowserTestCase):
# A pending build is listed as such.
build = self.makeBuild()
build.queueBuild()
- self.assertTextMatchesExpressionIgnoreWhitespace("""\
+ self.assertTextMatchesExpressionIgnoreWhitespace(r"""\
Latest builds
Status When complete Architecture Archive
Needs building in .* \(estimated\) i386
diff --git a/lib/lp/soyuz/model/archive.py b/lib/lp/soyuz/model/archive.py
index bbe2d7c..88e949e 100644
--- a/lib/lp/soyuz/model/archive.py
+++ b/lib/lp/soyuz/model/archive.py
@@ -1054,7 +1054,7 @@ class Archive(SQLBase):
from lp.soyuz.model.distroseriespackagecache import (
DistroSeriesPackageCache)
# Compiled regexp to remove puntication.
- clean_text = re.compile('(,|;|:|\.|\?|!)')
+ clean_text = re.compile(r'(,|;|:|\.|\?|!)')
# XXX cprov 20080402 bug=207969: The set() is only used because we
# have a limitation in our FTI setup, it only indexes the first 2500
diff --git a/lib/lp/soyuz/model/sourcepackagerelease.py b/lib/lp/soyuz/model/sourcepackagerelease.py
index 70261aa..03539e1 100644
--- a/lib/lp/soyuz/model/sourcepackagerelease.py
+++ b/lib/lp/soyuz/model/sourcepackagerelease.py
@@ -379,7 +379,7 @@ class SourcePackageRelease(SQLBase):
"""See ISourcePackageRelease"""
# this regex is copied from apt-listchanges.py courtesy of MDZ
new_stanza_line = re.compile(
- '^\S+ \((?P<version>.*)\) .*;.*urgency=(?P<urgency>\w+).*')
+ r'^\S+ \((?P<version>.*)\) .*;.*urgency=(?P<urgency>\w+).*')
logfile = io.StringIO(self.changelog_entry)
change = ''
top_stanza = False
diff --git a/lib/lp/soyuz/scripts/gina/packages.py b/lib/lp/soyuz/scripts/gina/packages.py
index 2b44a5a..0143f7f 100644
--- a/lib/lp/soyuz/scripts/gina/packages.py
+++ b/lib/lp/soyuz/scripts/gina/packages.py
@@ -105,8 +105,8 @@ def get_dsc_path(name, version, component, archive_root):
def unpack_dsc(package, version, component, distro_name, archive_root):
dsc_name, dsc_path, component = get_dsc_path(package, version,
component, archive_root)
- version = re.sub("^\d+:", "", version)
- version = re.sub("-[^-]+$", "", version)
+ version = re.sub(r"^\d+:", "", version)
+ version = re.sub(r"-[^-]+$", "", version)
source_dir = "%s-%s" % (package, version)
try:
extract_dpkg_source(dsc_path, ".", vendor=distro_name)