diff options
author | Adrian Freihofer <adrian.freihofer@gmail.com> | 2024-02-10 14:15:58 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-02-13 13:51:41 +0000 |
commit | fe58da13930638037283f9a96fc103835b15f919 (patch) | |
tree | 6687dbd93f42cfb9f4a89e7a096228c2245a2eb8 /meta | |
parent | 7f2755daca55c0abdca9a9a2c01ddc21292a99d6 (diff) | |
download | poky-fe58da13930638037283f9a96fc103835b15f919.tar.gz |
meta/lib/patchtest: python 3.12 regex
Python 3 interprets string literals as Unicode strings, and therefore
\s is treated as an escaped Unicode character which is not correct.
Declaring the RegEx pattern as a raw string instead of unicode is
required for Python 3.
(From OE-Core rev: 329a555f7b8f00c648c44b01f423e6da33a46245)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/lib/patchtest/tests/base.py | 4 | ||||
-rw-r--r-- | meta/lib/patchtest/utils.py | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/meta/lib/patchtest/tests/base.py b/meta/lib/patchtest/tests/base.py index aecbbc4aae..424e61b5be 100644 --- a/meta/lib/patchtest/tests/base.py +++ b/meta/lib/patchtest/tests/base.py | |||
@@ -34,8 +34,8 @@ class PatchtestOEError(Exception): | |||
34 | class Base(unittest.TestCase): | 34 | class Base(unittest.TestCase): |
35 | # if unit test fails, fail message will throw at least the following JSON: {"id": <testid>} | 35 | # if unit test fails, fail message will throw at least the following JSON: {"id": <testid>} |
36 | 36 | ||
37 | endcommit_messages_regex = re.compile('\(From \w+-\w+ rev:|(?<!\S)Signed-off-by|(?<!\S)---\n') | 37 | endcommit_messages_regex = re.compile(r'\(From \w+-\w+ rev:|(?<!\S)Signed-off-by|(?<!\S)---\n') |
38 | patchmetadata_regex = re.compile('-{3} \S+|\+{3} \S+|@{2} -\d+,\d+ \+\d+,\d+ @{2} \S+') | 38 | patchmetadata_regex = re.compile(r'-{3} \S+|\+{3} \S+|@{2} -\d+,\d+ \+\d+,\d+ @{2} \S+') |
39 | 39 | ||
40 | 40 | ||
41 | @staticmethod | 41 | @staticmethod |
diff --git a/meta/lib/patchtest/utils.py b/meta/lib/patchtest/utils.py index a4a523b4e2..dd0abc22d9 100644 --- a/meta/lib/patchtest/utils.py +++ b/meta/lib/patchtest/utils.py | |||
@@ -132,7 +132,7 @@ def get_subject_prefix(path): | |||
132 | if len(mbox): | 132 | if len(mbox): |
133 | subject = mbox[0]['subject'] | 133 | subject = mbox[0]['subject'] |
134 | if subject: | 134 | if subject: |
135 | pattern = re.compile("(\[.*\])", re.DOTALL) | 135 | pattern = re.compile(r"(\[.*\])", re.DOTALL) |
136 | match = pattern.search(subject) | 136 | match = pattern.search(subject) |
137 | if match: | 137 | if match: |
138 | prefix = match.group(1) | 138 | prefix = match.group(1) |
@@ -146,8 +146,8 @@ def valid_branch(branch): | |||
146 | invalid = lbranch.startswith('patch') or \ | 146 | invalid = lbranch.startswith('patch') or \ |
147 | lbranch.startswith('rfc') or \ | 147 | lbranch.startswith('rfc') or \ |
148 | lbranch.startswith('resend') or \ | 148 | lbranch.startswith('resend') or \ |
149 | re.search('^v\d+', lbranch) or \ | 149 | re.search(r'^v\d+', lbranch) or \ |
150 | re.search('^\d+/\d+', lbranch) | 150 | re.search(r'^\d+/\d+', lbranch) |
151 | 151 | ||
152 | return not invalid | 152 | return not invalid |
153 | 153 | ||