packagedata.py: silence a DeprecationWarning
PATCH 1/1 packagedata.py: silence a DeprecationWarning
From: Mingli Yu <[email protected]>
Use regex strings (r’’) to silence below deprecation warning [1]:
$ cat tmp/work/intel_x86_64-wrs-linux/linux-yocto/5.10.x+gitAUTOINC+917c420111_373c02c3ca-r0/temp/log.do_deploy
[snip]
/build/layers/oe-core/meta/lib/oe/packagedata.py:22: DeprecationWarning: invalid escape sequence \s
r = re.compile("(^.+?):\s+(.*)")
[snip][1] https://docs.python.org/3/library/re.html
--- meta/lib/oe/packagedata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/packagedata.py +1 -1
@@ -19,7 +19,7 @@ def read_pkgdatafile(fn): import re with open(fn, 'r') as f: lines = f.readlines() - r = re.compile("(^.+?):\s+(.*)") + r = re.compile(r"(^.+?):\s+(.*)") for l in lines: m = r.match(l) if m:
Signature · 1 line
2.17.1
Quoted 10 lines · Mingli
From: Mingli Yu <[email protected]>
Use regex strings (r’’) to silence below deprecation warning [1]:
$ cat tmp/work/intel_x86_64-wrs-linux/linux-yocto/5.10.x+gitAUTOINC+917c420111_373c02c3ca-r0/temp/log.do_deploy [snip] /build/layers/oe-core/meta/lib/oe/packagedata.py:22: DeprecationWarning: invalid escape sequence \s r = re.compile("(^.+?):\s+(.*)") [snip]
"Also, please note that any invalid escape sequences in Python’s usage of the backslash in string literals now generate a DeprecationWarning and in the future this will become a SyntaxError."
so it would seem that our use is invalid and if so we should fix it before it becomes an error, right?
If so please create a YP bugzilla defect.
Thanks,
../Randy
Quoted 30 lines
Signed-off-by Mingli Yu <[email protected]>--- meta/lib/oe/packagedata.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)meta/lib/oe/packagedata.py +1
-2@@ -19,7 +19,7 @@ def read_pkgdatafile(fn): import re with open(fn, 'r') as f: lines = f.readlines() - r = re.compile("(^.+?):\s+(.*)") + r = re.compile(r"(^.+?):\s+(.*)") for l in lines: m = r.match(l) if m: -=-=-=-=-=-=-=-=-=-=-=-Links: You receive all messages sent to this group.
View/Reply Online (#156812): https://lists.openembedded.org/g/openembedded-core/message/156812
Mute This Topic: https://lists.openembedded.org/mt/86232043/3616765
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 2 lines
# Randy MacLeod # Wind River Linux
Quoted 13 lines · Randy MacLeod
Quoted 10 lines · Mingli
From: Mingli Yu <[email protected]>
Use regex strings (r’’) to silence below deprecation warning [1]:
$ cat tmp/work/intel_x86_64-wrs-linux/linux-yocto/5.10.x+gitAUTOINC+917c420111_373c02c3ca-r0/temp/log.do_deploy [snip] /build/layers/oe-core/meta/lib/oe/packagedata.py:22: DeprecationWarning: invalid escape sequence \s r = re.compile("(^.+?):\s+(.*)") [snip]
Quoted 8 lines
"Also, please note that any invalid escape sequences in Python’s usage of the backslash in string literals now generate a DeprecationWarning and in the future this will become a SyntaxError."
so it would seem that our use is invalid and if so we should fix it before it becomes an error, right?
If so please create a YP bugzilla defect.
The patch is the right fix and will avoid those issues as it is now correctly marked as a regex.
Cheers,
Richard