Skip to contentSkip to conversation

bb/fetch2/__init__.py: remove a DeprecationWarning in uri_replace()

PATCH New Bin Lan 1 participant 1 message Jan 9, 2025

lore
Share & tools
lore

Bin Lan

author
#0 lore raw

PATCH 1/1 bb/fetch2/__init__.py: remove a DeprecationWarning in uri_replace()

There is the following warning when executing to bitbake linux-yocto:
bitbake/lib/bb/fetch2/__init__.py:464: DeprecationWarning: 'count' is passed as positional argument

This is because the 4th parameter of re.sub(pattern, repl, string, count=0, flags=0) is a keyword parameter. We use keyword arguments for parameters that are not positional.

---
 lib/bb/fetch2/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +1 -1
index f79e278b1..3c9b90eb7 100644
@@ -461,7 +461,7 @@ def uri_replace(ud, uri_find, uri_replace, replacements, d, mirrortarball=None):
                 for k in replacements:
                     uri_replace_decoded[loc] = uri_replace_decoded[loc].replace(k, replacements[k])
                 #bb.note("%s %s %s" % (regexp, uri_replace_decoded[loc], uri_decoded[loc]))
-                result_decoded[loc] = re.sub(regexp, uri_replace_decoded[loc], uri_decoded[loc], 1)
+                result_decoded[loc] = re.sub(regexp, uri_replace_decoded[loc], uri_decoded[loc], count=1)
             if loc == 2:
                 # Handle path manipulations
                 basename = None
Signature · 1 line
2.34.1