mirror of
https://git.yoctoproject.org/poky
synced 2026-05-08 05:09:24 +00:00
scripts: python 3.12 regex
All the regexes throw a warning like this:
WARNING: scripts/lib/recipetool/create_buildsys.py:140:
SyntaxWarning: invalid escape sequence '\s'
proj_re = re.compile('project\s*\(([^)]*)\)', re.IGNORECASE)
Python 3 interprets string literals as Unicode strings, and therefore
\s is treated as an escaped Unicode character which is not correct.
Declaring the RegEx pattern as a raw string instead of unicode is
required for Python 3.
(From OE-Core rev: 63998f13d5263ce19a60ed3fba1ac8b6f23558e3)
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Backported from master: 24b0ba00d4f0b4d9834f7693ecb6032dfc534a80
Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
committed by
Steve Sakoman
parent
95b1e23223
commit
0269cfc91c
@@ -36,8 +36,8 @@ def bbvar_is_documented(var, documented_vars):
|
||||
def collect_documented_vars(docfiles):
|
||||
''' Walk the docfiles and collect the documented variables '''
|
||||
documented_vars = []
|
||||
prog = re.compile(".*($|[^A-Z_])<glossentry id=\'var-")
|
||||
var_prog = re.compile('<glossentry id=\'var-(.*)\'>')
|
||||
prog = re.compile(r".*($|[^A-Z_])<glossentry id=\'var-")
|
||||
var_prog = re.compile(r'<glossentry id=\'var-(.*)\'>')
|
||||
for d in docfiles:
|
||||
with open(d) as f:
|
||||
documented_vars += var_prog.findall(f.read())
|
||||
@@ -45,7 +45,7 @@ def collect_documented_vars(docfiles):
|
||||
return documented_vars
|
||||
|
||||
def bbvar_doctag(var, docconf):
|
||||
prog = re.compile('^%s\[doc\] *= *"(.*)"' % (var))
|
||||
prog = re.compile(r'^%s\[doc\] *= *"(.*)"' % (var))
|
||||
if docconf == "":
|
||||
return "?"
|
||||
|
||||
|
||||
@@ -81,19 +81,19 @@ skip_ext = [".html", ".patch", ".m4", ".diff"] + args.skip_ext
|
||||
|
||||
vars_re = {}
|
||||
for exp in vars:
|
||||
vars_re[exp] = (re.compile('((^|[#\'"\s\-\+])[A-Za-z0-9_\-:${}\.]+)_' + exp), r"\1:" + exp)
|
||||
vars_re[exp] = (re.compile(r'((^|[#\'"\s\-\+])[A-Za-z0-9_\-:${}\.]+)_' + exp), r"\1:" + exp)
|
||||
|
||||
shortvars_re = {}
|
||||
for exp in shortvars:
|
||||
shortvars_re[exp] = (re.compile('((^|[#\'"\s\-\+])[A-Za-z0-9_\-:${}\.]+)_' + exp + '([\(\'"\s:])'), r"\1:" + exp + r"\3")
|
||||
shortvars_re[exp] = (re.compile(r'((^|[#\'"\s\-\+])[A-Za-z0-9_\-:${}\.]+)_' + exp + r'([\(\'"\s:])'), r"\1:" + exp + r"\3")
|
||||
|
||||
package_re = {}
|
||||
for exp in packagevars:
|
||||
package_re[exp] = (re.compile('(^|[#\'"\s\-\+]+)' + exp + '_' + '([$a-z"\'\s%\[<{\\\*].)'), r"\1" + exp + r":\2")
|
||||
package_re[exp] = (re.compile(r'(^|[#\'"\s\-\+]+)' + exp + r'_' + r'([$a-z"\'\s%\[<{\\\*].)'), r"\1" + exp + r":\2")
|
||||
|
||||
# Other substitutions to make
|
||||
subs = {
|
||||
'r = re.compile("([^:]+):\s*(.*)")' : 'r = re.compile("(^.+?):\s+(.*)")',
|
||||
'r = re.compile(r"([^:]+):\s*(.*)")' : 'r = re.compile(r"(^.+?):\s+(.*)")',
|
||||
"val = d.getVar('%s_%s' % (var, pkg))" : "val = d.getVar('%s:%s' % (var, pkg))",
|
||||
"f.write('%s_%s: %s\\n' % (var, pkg, encode(val)))" : "f.write('%s:%s: %s\\n' % (var, pkg, encode(val)))",
|
||||
"d.getVar('%s_%s' % (scriptlet_name, pkg))" : "d.getVar('%s:%s' % (scriptlet_name, pkg))",
|
||||
|
||||
Reference in New Issue
Block a user