Skip to content

Commit

Permalink
cooker: Drop sre_constants usage
Browse files Browse the repository at this point in the history
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
  • Loading branch information
rpurdie authored and shr-project committed Jun 17, 2022
1 parent 716e1e2 commit 5968817
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions 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 @@ -1833,15 +1832,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 5968817

Please sign in to comment.