From cd4b8a8553f9d551af27941910cf4d3405ecb7b0 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 14 Jan 2019 15:49:50 +0000 Subject: meta: Fix Deprecated warnings from regexs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix handling of escape characters in regexs and hence fix python Deprecation warnings which will be problematic in python 3.8. Note that some show up as: """ meta/classes/package.bbclass:1293: DeprecationWarning: invalid escape sequence \.   """ where the problem isn't on 1293 in package.bbclass but in some _prepend to a package.bbclass function in a different file like mesa.inc, often from do_package_split() calls. (From OE-Core rev: 4b1c0c7d5525fc4cea9e0f02ec54e92a6fbc6199) Signed-off-by: Richard Purdie --- meta/classes/package.bbclass | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'meta/classes/package.bbclass') diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass index 7a7bc9e2f0..853735f0c6 100644 --- a/meta/classes/package.bbclass +++ b/meta/classes/package.bbclass @@ -75,7 +75,7 @@ def legitimize_package_name(s): return ('\\u%s' % cp).encode('latin-1').decode('unicode_escape') # Handle unicode codepoints encoded as , as in glibc locale files. - s = re.sub('', fixutf, s) + s = re.sub(r'', fixutf, s) # Remaining package name validity fixes return s.lower().replace('_', '-').replace('@', '+').replace(',', '+').replace('/', '-') @@ -1590,8 +1590,8 @@ python package_do_shlibs() { bb.note("not generating shlibs") return - lib_re = re.compile("^.*\.so") - libdir_re = re.compile(".*/%s$" % d.getVar('baselib')) + lib_re = re.compile(r"^.*\.so") + libdir_re = re.compile(r".*/%s$" % d.getVar('baselib')) packages = d.getVar('PACKAGES') @@ -1632,17 +1632,17 @@ python package_do_shlibs() { fd.close() rpath = tuple() for l in lines: - m = re.match("\s+RPATH\s+([^\s]*)", l) + m = re.match(r"\s+RPATH\s+([^\s]*)", l) if m: rpaths = m.group(1).replace("$ORIGIN", ldir).split(":") rpath = tuple(map(os.path.normpath, rpaths)) for l in lines: - m = re.match("\s+NEEDED\s+([^\s]*)", l) + m = re.match(r"\s+NEEDED\s+([^\s]*)", l) if m: dep = m.group(1) if dep not in needed: needed.add((dep, file, rpath)) - m = re.match("\s+SONAME\s+([^\s]*)", l) + m = re.match(r"\s+SONAME\s+([^\s]*)", l) if m: this_soname = m.group(1) prov = (this_soname, ldir, pkgver) @@ -1722,7 +1722,7 @@ python package_do_shlibs() { out, err = p.communicate() # process the output, grabbing all .dll names if p.returncode == 0: - for m in re.finditer("DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE): + for m in re.finditer(r"DLL Name: (.*?\.dll)$", out.decode(), re.MULTILINE | re.IGNORECASE): dllname = m.group(1) if dllname: needed[pkg].add((dllname, file, tuple())) @@ -1883,9 +1883,9 @@ python package_do_pkgconfig () { shlibs_dirs = d.getVar('SHLIBSDIRS').split() shlibswork_dir = d.getVar('SHLIBSWORKDIR') - pc_re = re.compile('(.*)\.pc$') - var_re = re.compile('(.*)=(.*)') - field_re = re.compile('(.*): (.*)') + pc_re = re.compile(r'(.*)\.pc$') + var_re = re.compile(r'(.*)=(.*)') + field_re = re.compile(r'(.*): (.*)') pkgconfig_provided = {} pkgconfig_needed = {} @@ -1933,7 +1933,7 @@ python package_do_pkgconfig () { if not os.path.exists(dir): continue for file in os.listdir(dir): - m = re.match('^(.*)\.pclist$', file) + m = re.match(r'^(.*)\.pclist$', file) if m: pkg = m.group(1) fd = open(os.path.join(dir, file)) -- cgit v1.2.3-54-g00ecf