Skip to content

Commit

Permalink
bitbake: cooker: Drop sre_constants usage
Browse files Browse the repository at this point in the history
Source: poky
MR: 125004
Type: Integration
Disposition: Merged from poky
ChangeID: 86e2430d3f40433f978667f15ab6d20d0663e56d
Description:

As reported by Martin Jansa <Martin.Jansa@gmail.com>:

bitbake/lib/bb/cooker.py:16: DeprecationWarning: module 'sre_constants' is deprecated
  import sre_constants

it's deprecated since 3.11 with:

  python/cpython#91308

The correct replacement for our usage is re.error so use that instead.

(Bitbake rev: a4cd5b0b4b355b7b75fb48c61289700e3e908b2a)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Jeremy A. Puhlman <jpuhlman@mvista.com>
  • Loading branch information
rpurdie authored and jpuhlman committed Feb 24, 2023
1 parent 4f70b5a commit 201b9f7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions bitbake/lib/bb/cooker.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import itertools
import logging
import multiprocessing
import sre_constants
import threading
from io import StringIO, UnsupportedOperation
from contextlib import closing
Expand Down Expand Up @@ -1795,15 +1794,15 @@ def ourscandir(d):
try:
re.compile(mask)
bbmasks.append(mask)
except sre_constants.error:
except re.error:
collectlog.critical("BBMASK contains an invalid regular expression, ignoring: %s" % mask)

# Then validate the combined regular expressions. This should never
# fail, but better safe than sorry...
bbmask = "|".join(bbmasks)
try:
bbmask_compiled = re.compile(bbmask)
except sre_constants.error:
except re.error:
collectlog.critical("BBMASK is not a valid regular expression, ignoring: %s" % bbmask)
bbmask = None

Expand Down

0 comments on commit 201b9f7

Please sign in to comment.