openembedded-core.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] packagedata.py: silence a DeprecationWarning
@ 2021-10-11  8:28 mingli.yu
  2021-10-13 16:40 ` [OE-core] " Randy MacLeod
  0 siblings, 1 reply; 3+ messages in thread
From: mingli.yu @ 2021-10-11  8:28 UTC (permalink / raw)
  To: openembedded-core

From: Mingli Yu <mingli.yu@windriver.com>

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

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
 meta/lib/oe/packagedata.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index 02c81e5a52..212f048bc6 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -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:
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] packagedata.py: silence a DeprecationWarning
  2021-10-11  8:28 [PATCH] packagedata.py: silence a DeprecationWarning mingli.yu
@ 2021-10-13 16:40 ` Randy MacLeod
  2021-10-13 16:51   ` Richard Purdie
  0 siblings, 1 reply; 3+ messages in thread
From: Randy MacLeod @ 2021-10-13 16:40 UTC (permalink / raw)
  To: Yu, Mingli, openembedded-core

On 2021-10-11 4:28 a.m., Yu, Mingli wrote:
> From: Mingli Yu <mingli.yu@windriver.com>
> 
> 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


"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

> 
> Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
> ---
>   meta/lib/oe/packagedata.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
> index 02c81e5a52..212f048bc6 100644
> --- a/meta/lib/oe/packagedata.py
> +++ b/meta/lib/oe/packagedata.py
> @@ -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: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [randy.macleod@windriver.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
# Randy MacLeod
# Wind River Linux



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH] packagedata.py: silence a DeprecationWarning
  2021-10-13 16:40 ` [OE-core] " Randy MacLeod
@ 2021-10-13 16:51   ` Richard Purdie
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Purdie @ 2021-10-13 16:51 UTC (permalink / raw)
  To: Randy MacLeod, Yu, Mingli, openembedded-core

On Wed, 2021-10-13 at 12:40 -0400, Randy MacLeod wrote:
> On 2021-10-11 4:28 a.m., Yu, Mingli wrote:
> > From: Mingli Yu <mingli.yu@windriver.com>
> > 
> > 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
> 
> 
> "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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-13 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11  8:28 [PATCH] packagedata.py: silence a DeprecationWarning mingli.yu
2021-10-13 16:40 ` [OE-core] " Randy MacLeod
2021-10-13 16:51   ` Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).