From 490bca81c31983a95854bd6970f7ac0edb5a3955 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 13 Nov 2018 22:46:44 +0000 Subject: bitbake: utils: Avoid regex value escape warnings Avoid warnings such as: bitbake/lib/bb/utils.py:72: DeprecationWarning: invalid escape sequence \d numeric_regexp = re.compile('^(\d+)(.*)$') bitbake/lib/bb/utils.py:1165: DeprecationWarning: invalid escape sequence \( var_res[var] = re.compile('^(%s%s)[ \\t]*\([ \\t]*\)[ \\t]*{' % (var[:-2].rstrip(), override_re)) (Bitbake rev: bbf3cbae775383265292a778cd522d4e2f69a3a0) Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 461122bba1..3b0c9599c4 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -69,8 +69,8 @@ class VersionStringException(Exception): def explode_version(s): r = [] - alpha_regexp = re.compile('^([a-zA-Z]+)(.*)$') - numeric_regexp = re.compile('^(\d+)(.*)$') + alpha_regexp = re.compile(r'^([a-zA-Z]+)(.*)$') + numeric_regexp = re.compile(r'^(\d+)(.*)$') while (s != ''): if s[0] in string.digits: m = numeric_regexp.match(s) @@ -1158,14 +1158,14 @@ def edit_metadata(meta_lines, variables, varfunc, match_overrides=False): var_res = {} if match_overrides: - override_re = '(_[a-zA-Z0-9-_$(){}]+)?' + override_re = r'(_[a-zA-Z0-9-_$(){}]+)?' else: override_re = '' for var in variables: if var.endswith('()'): - var_res[var] = re.compile('^(%s%s)[ \\t]*\([ \\t]*\)[ \\t]*{' % (var[:-2].rstrip(), override_re)) + var_res[var] = re.compile(r'^(%s%s)[ \\t]*\([ \\t]*\)[ \\t]*{' % (var[:-2].rstrip(), override_re)) else: - var_res[var] = re.compile('^(%s%s)[ \\t]*[?+:.]*=[+.]*[ \\t]*(["\'])' % (var, override_re)) + var_res[var] = re.compile(r'^(%s%s)[ \\t]*[?+:.]*=[+.]*[ \\t]*(["\'])' % (var, override_re)) updated = False varset_start = '' -- cgit v1.2.3-54-g00ecf