mirror of
https://github.com/samba-team/samba.git
synced 2025-02-25 17:57:42 +03:00
python: Don't use deprecated escape sequences
Certain escape sequences are not valid in Python string literals, and will eventually result in a SyntaxError. Follow up patch of 5045382c6dd04b1bae0eaaae823be908213ff079 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Fri Jan 20 09:06:49 UTC 2023 on atb-devel-224
This commit is contained in:
parent
91f1567cdc
commit
253891032e
@ -13,10 +13,10 @@ def subst_at_vars(task):
|
||||
s = task.inputs[0].read()
|
||||
|
||||
# split on the vars
|
||||
a = re.split('(@\w+@)', s)
|
||||
a = re.split(r'(@\w+@)', s)
|
||||
out = []
|
||||
for v in a:
|
||||
if re.match('@\w+@', v):
|
||||
if re.match(r'@\w+@', v):
|
||||
vname = v[1:-1]
|
||||
if not vname in task.env and vname.upper() in task.env:
|
||||
vname = vname.upper()
|
||||
|
@ -9,12 +9,12 @@ def subst_at_vars(task):
|
||||
|
||||
s = task.inputs[0].read()
|
||||
# split on the vars
|
||||
a = re.split('(@\w+@)', s)
|
||||
a = re.split(r'(@\w+@)', s)
|
||||
out = []
|
||||
done_var = {}
|
||||
back_sub = [ ('PREFIX', '${prefix}'), ('EXEC_PREFIX', '${exec_prefix}')]
|
||||
for v in a:
|
||||
if re.match('@\w+@', v):
|
||||
if re.match(r'@\w+@', v):
|
||||
vname = v[1:-1]
|
||||
if not vname in task.env and vname.upper() in task.env:
|
||||
vname = vname.upper()
|
||||
|
@ -21,16 +21,16 @@ version_key = lambda x: list(map(int, x.split(".")))
|
||||
def normalise_signature(sig):
|
||||
'''normalise a signature from gdb'''
|
||||
sig = sig.strip()
|
||||
sig = re.sub('^\$[0-9]+\s=\s\{(.+)\}$', r'\1', sig)
|
||||
sig = re.sub('^\$[0-9]+\s=\s\{(.+)\}(\s0x[0-9a-f]+\s<\w+>)+$', r'\1', sig)
|
||||
sig = re.sub('^\$[0-9]+\s=\s(0x[0-9a-f]+)\s?(<\w+>)?$', r'\1', sig)
|
||||
sig = re.sub('0x[0-9a-f]+', '0xXXXX', sig)
|
||||
sig = re.sub(r'^\$[0-9]+\s=\s\{(.+)\}$', r'\1', sig)
|
||||
sig = re.sub(r'^\$[0-9]+\s=\s\{(.+)\}(\s0x[0-9a-f]+\s<\w+>)+$', r'\1', sig)
|
||||
sig = re.sub(r'^\$[0-9]+\s=\s(0x[0-9a-f]+)\s?(<\w+>)?$', r'\1', sig)
|
||||
sig = re.sub(r'0x[0-9a-f]+', '0xXXXX', sig)
|
||||
sig = re.sub('", <incomplete sequence (\\\\[a-z0-9]+)>', r'\1"', sig)
|
||||
|
||||
for t in abi_type_maps:
|
||||
# we need to cope with non-word characters in mapped types
|
||||
m = t
|
||||
m = m.replace('*', '\*')
|
||||
m = m.replace('*', r'\*')
|
||||
if m[-1].isalnum() or m[-1] == '_':
|
||||
m += '\\b'
|
||||
if m[0].isalnum() or m[0] == '_':
|
||||
@ -41,7 +41,7 @@ def normalise_signature(sig):
|
||||
|
||||
def normalise_varargs(sig):
|
||||
'''cope with older versions of gdb'''
|
||||
sig = re.sub(',\s\.\.\.', '', sig)
|
||||
sig = re.sub(r',\s\.\.\.', '', sig)
|
||||
return sig
|
||||
|
||||
|
||||
|
@ -398,7 +398,7 @@ WriteMakefile(
|
||||
|
||||
if section:
|
||||
man = Utils.readf(os.path.join(bdir,'Makefile'))
|
||||
m = re.search('MAN%sEXT\s+=\s+(\w+)' % section, man)
|
||||
m = re.search(r'MAN%sEXT\s+=\s+(\w+)' % section, man)
|
||||
if not m:
|
||||
conf.end_msg('not found', color='YELLOW')
|
||||
return
|
||||
|
@ -19,7 +19,7 @@ def header_install_path(header, header_path):
|
||||
return ''
|
||||
|
||||
|
||||
re_header = re.compile('^\s*#\s*include[ \t]*"([^"]+)"', re.I | re.M)
|
||||
re_header = re.compile(r'^\s*#\s*include[ \t]*"([^"]+)"', re.I | re.M)
|
||||
|
||||
# a dictionary mapping source header paths to public header paths
|
||||
header_map = {}
|
||||
|
@ -237,10 +237,10 @@ def TO_LIST(str, delimiter=None):
|
||||
|
||||
def subst_vars_error(string, env):
|
||||
'''substitute vars, throw an error if a variable is not defined'''
|
||||
lst = re.split('(\$\{\w+\})', string)
|
||||
lst = re.split(r'(\$\{\w+\})', string)
|
||||
out = []
|
||||
for v in lst:
|
||||
if re.match('\$\{\w+\}', v):
|
||||
if re.match(r'\$\{\w+\}', v):
|
||||
vname = v[2:-1]
|
||||
if not vname in env:
|
||||
raise KeyError("Failed to find variable %s in %s in env %s <%s>" % (vname, string, env.__class__, str(env)))
|
||||
|
@ -119,9 +119,9 @@ def find_ldd_path(bld, libname, binary):
|
||||
|
||||
|
||||
# some regular expressions for parsing readelf output
|
||||
re_sharedlib = re.compile(b'Shared library: \[(.*)\]')
|
||||
re_sharedlib = re.compile(rb'Shared library: \[(.*)\]')
|
||||
# output from readelf could be `Library rpath` or `Libray runpath`
|
||||
re_rpath = re.compile(b'Library (rpath|runpath): \[(.*)\]')
|
||||
re_rpath = re.compile(rb'Library (rpath|runpath): \[(.*)\]')
|
||||
|
||||
def get_libs(bld, binname):
|
||||
'''find the list of linked libraries for any binary or library
|
||||
|
Loading…
x
Reference in New Issue
Block a user