mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-21 09:27:17 +01:00
Fix all DeprecationWarning: invalid escape sequence
Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
This commit is contained in:
parent
e68dc88857
commit
412a9b819e
@ -174,7 +174,7 @@ def createVCProjFile(lib_number, classes):
|
||||
""")
|
||||
|
||||
for i in range(classes):
|
||||
handle.write(' <File RelativePath=".\class_' + str(i) + '.cpp"/>\n')
|
||||
handle.write(r' <File RelativePath=".\class_' + str(i) + '.cpp"/>\n')
|
||||
|
||||
handle.write("""
|
||||
</Files>
|
||||
|
@ -104,7 +104,7 @@ class BuildContext(Context.Context):
|
||||
"""Amount of jobs to run in parallel"""
|
||||
|
||||
self.targets = Options.options.targets
|
||||
"""List of targets to build (default: \*)"""
|
||||
"""List of targets to build (default: \\*)"""
|
||||
|
||||
self.keep = Options.options.keep
|
||||
"""Whether the build should continue past errors"""
|
||||
|
@ -11,7 +11,7 @@ The values put in :py:class:`ConfigSet` must be serializable (dicts, lists, stri
|
||||
|
||||
import copy, re, os
|
||||
from waflib import Logs, Utils
|
||||
re_imp = re.compile('^(#)*?([^#=]*?)\ =\ (.*?)$', re.M)
|
||||
re_imp = re.compile(r'^(#)*?([^#=]*?)\ =\ (.*?)$', re.M)
|
||||
|
||||
class ConfigSet(object):
|
||||
"""
|
||||
|
@ -607,7 +607,7 @@ class Context(ctx):
|
||||
Logs.pprint(color, msg)
|
||||
|
||||
def load_special_tools(self, var, ban=[]):
|
||||
"""
|
||||
r"""
|
||||
Loads third-party extensions modules for certain programming languages
|
||||
by trying to list certain files in the extras/ directory. This method
|
||||
is typically called once for a programming language group, see for
|
||||
|
@ -1044,7 +1044,7 @@ def funex(c):
|
||||
exec(c, dc)
|
||||
return dc['f']
|
||||
|
||||
re_cond = re.compile('(?P<var>\w+)|(?P<or>\|)|(?P<and>&)')
|
||||
re_cond = re.compile(r'(?P<var>\w+)|(?P<or>\|)|(?P<and>&)')
|
||||
re_novar = re.compile(r'^(SRC|TGT)\W+.*?$')
|
||||
reg_act = re.compile(r'(?P<backslash>\\)|(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})', re.M)
|
||||
def compile_fun_shell(line):
|
||||
|
@ -727,7 +727,7 @@ def sequence_order(self):
|
||||
self.bld.prev = self
|
||||
|
||||
|
||||
re_m4 = re.compile('@(\w+)@', re.M)
|
||||
re_m4 = re.compile(r'@(\w+)@', re.M)
|
||||
|
||||
class subst_pc(Task.Task):
|
||||
"""
|
||||
|
@ -239,7 +239,7 @@ def validate_cfg(self, kw):
|
||||
|
||||
@conf
|
||||
def exec_cfg(self, kw):
|
||||
"""
|
||||
r"""
|
||||
Executes ``pkg-config`` or other ``-config`` applications to collect configuration flags:
|
||||
|
||||
* if atleast_pkgconfig_version is given, check that pkg-config has the version n and return
|
||||
|
@ -75,13 +75,13 @@ re_lines = re.compile(
|
||||
re.IGNORECASE | re.MULTILINE)
|
||||
"""Match #include lines"""
|
||||
|
||||
re_mac = re.compile("^[a-zA-Z_]\w*")
|
||||
re_mac = re.compile(r"^[a-zA-Z_]\w*")
|
||||
"""Match macro definitions"""
|
||||
|
||||
re_fun = re.compile('^[a-zA-Z_][a-zA-Z0-9_]*[(]')
|
||||
"""Match macro functions"""
|
||||
|
||||
re_pragma_once = re.compile('^\s*once\s*', re.IGNORECASE)
|
||||
re_pragma_once = re.compile(r'^\s*once\s*', re.IGNORECASE)
|
||||
"""Match #pragma once statements"""
|
||||
|
||||
re_nl = re.compile('\\\\\r*\n', re.MULTILINE)
|
||||
@ -660,7 +660,7 @@ def extract_macro(txt):
|
||||
# empty define, assign an empty token
|
||||
return (v, [[], [('T','')]])
|
||||
|
||||
re_include = re.compile('^\s*(<(?:.*)>|"(?:.*)")')
|
||||
re_include = re.compile(r'^\s*(<(?:.*)>|"(?:.*)")')
|
||||
def extract_include(txt, defs):
|
||||
"""
|
||||
Process a line in the form::
|
||||
|
@ -93,8 +93,8 @@ class d_parser(object):
|
||||
|
||||
self.allnames = []
|
||||
|
||||
self.re_module = re.compile("module\s+([^;]+)")
|
||||
self.re_import = re.compile("import\s+([^;]+)")
|
||||
self.re_module = re.compile(r"module\s+([^;]+)")
|
||||
self.re_import = re.compile(r"import\s+([^;]+)")
|
||||
self.re_import_bindings = re.compile("([^:]+):(.*)")
|
||||
self.re_import_alias = re.compile("[^=]+=(.+)")
|
||||
|
||||
@ -138,7 +138,7 @@ class d_parser(object):
|
||||
|
||||
mod_name = self.re_module.search(code)
|
||||
if mod_name:
|
||||
self.module = re.sub('\s+', '', mod_name.group(1)) # strip all whitespaces
|
||||
self.module = re.sub(r'\s+', '', mod_name.group(1)) # strip all whitespaces
|
||||
|
||||
# go through the code, have a look at all import occurrences
|
||||
|
||||
@ -146,7 +146,7 @@ class d_parser(object):
|
||||
import_iterator = self.re_import.finditer(code)
|
||||
if import_iterator:
|
||||
for import_match in import_iterator:
|
||||
import_match_str = re.sub('\s+', '', import_match.group(1)) # strip all whitespaces
|
||||
import_match_str = re.sub(r'\s+', '', import_match.group(1)) # strip all whitespaces
|
||||
|
||||
# does this end with an import bindings declaration?
|
||||
# (import bindings always terminate the list of imports)
|
||||
|
@ -178,8 +178,8 @@ def check_fortran_dummy_main(self, *k, **kw):
|
||||
# ------------------------------------------------------------------------
|
||||
|
||||
GCC_DRIVER_LINE = re.compile('^Driving:')
|
||||
POSIX_STATIC_EXT = re.compile('\S+\.a')
|
||||
POSIX_LIB_FLAGS = re.compile('-l\S+')
|
||||
POSIX_STATIC_EXT = re.compile(r'\S+\.a')
|
||||
POSIX_LIB_FLAGS = re.compile(r'-l\S+')
|
||||
|
||||
@conf
|
||||
def is_link_verbose(self, txt):
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
import re
|
||||
|
||||
INC_REGEX = """(?:^|['">]\s*;)\s*(?:|#\s*)INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])"""
|
||||
USE_REGEX = """(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)"""
|
||||
MOD_REGEX = """(?:^|;)\s*MODULE(?!\s+(?:PROCEDURE|SUBROUTINE|FUNCTION))\s+(\w+)"""
|
||||
SMD_REGEX = """(?:^|;)\s*SUBMODULE\s*\(([\w:]+)\)\s*(\w+)"""
|
||||
INC_REGEX = r"""(?:^|['">]\s*;)\s*(?:|#\s*)INCLUDE\s+(?:\w+_)?[<"'](.+?)(?=["'>])"""
|
||||
USE_REGEX = r"""(?:^|;)\s*USE(?:\s+|(?:(?:\s*,\s*(?:NON_)?INTRINSIC)?\s*::))\s*(\w+)"""
|
||||
MOD_REGEX = r"""(?:^|;)\s*MODULE(?!\s+(?:PROCEDURE|SUBROUTINE|FUNCTION))\s+(\w+)"""
|
||||
SMD_REGEX = r"""(?:^|;)\s*SUBMODULE\s*\(([\w:]+)\)\s*(\w+)"""
|
||||
|
||||
re_inc = re.compile(INC_REGEX, re.I)
|
||||
re_use = re.compile(USE_REGEX, re.I)
|
||||
|
@ -107,7 +107,7 @@ def gather_ifort_versions(conf, versions):
|
||||
"""
|
||||
List compiler versions by looking up registry keys
|
||||
"""
|
||||
version_pattern = re.compile('^...?.?\....?.?')
|
||||
version_pattern = re.compile(r'^...?.?\....?.?')
|
||||
try:
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Compilers\\Fortran')
|
||||
except OSError:
|
||||
|
@ -281,7 +281,7 @@ def gather_wince_supported_platforms():
|
||||
|
||||
def gather_msvc_detected_versions():
|
||||
#Detected MSVC versions!
|
||||
version_pattern = re.compile('^(\d\d?\.\d\d?)(Exp)?$')
|
||||
version_pattern = re.compile(r'^(\d\d?\.\d\d?)(Exp)?$')
|
||||
detected_versions = []
|
||||
for vcver,vcvar in (('VCExpress','Exp'), ('VisualStudio','')):
|
||||
prefix = 'SOFTWARE\\Wow6432node\\Microsoft\\' + vcver
|
||||
@ -367,7 +367,7 @@ def gather_wsdk_versions(conf, versions):
|
||||
:param versions: list to modify
|
||||
:type versions: list
|
||||
"""
|
||||
version_pattern = re.compile('^v..?.?\...?.?')
|
||||
version_pattern = re.compile(r'^v..?.?\...?.?')
|
||||
try:
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows')
|
||||
except OSError:
|
||||
@ -525,7 +525,7 @@ def gather_icl_versions(conf, versions):
|
||||
:param versions: list to modify
|
||||
:type versions: list
|
||||
"""
|
||||
version_pattern = re.compile('^...?.?\....?.?')
|
||||
version_pattern = re.compile(r'^...?.?\....?.?')
|
||||
try:
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++')
|
||||
except OSError:
|
||||
@ -579,7 +579,7 @@ def gather_intel_composer_versions(conf, versions):
|
||||
:param versions: list to modify
|
||||
:type versions: list
|
||||
"""
|
||||
version_pattern = re.compile('^...?.?\...?.?.?')
|
||||
version_pattern = re.compile(r'^...?.?\...?.?.?')
|
||||
try:
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Suites')
|
||||
except OSError:
|
||||
@ -683,7 +683,7 @@ def find_lt_names_msvc(self, libname, is_static=False):
|
||||
if not is_static and ltdict.get('library_names', ''):
|
||||
dllnames=ltdict['library_names'].split()
|
||||
dll=dllnames[0].lower()
|
||||
dll=re.sub('\.dll$', '', dll)
|
||||
dll=re.sub(r'\.dll$', '', dll)
|
||||
return (lt_libdir, dll, False)
|
||||
elif ltdict.get('old_library', ''):
|
||||
olib=ltdict['old_library']
|
||||
@ -700,7 +700,7 @@ def find_lt_names_msvc(self, libname, is_static=False):
|
||||
@conf
|
||||
def libname_msvc(self, libname, is_static=False):
|
||||
lib = libname.lower()
|
||||
lib = re.sub('\.lib$','',lib)
|
||||
lib = re.sub(r'\.lib$','',lib)
|
||||
|
||||
if lib in g_msvc_systemlibs:
|
||||
return lib
|
||||
@ -747,11 +747,11 @@ def libname_msvc(self, libname, is_static=False):
|
||||
for libn in libnames:
|
||||
if os.path.exists(os.path.join(path, libn)):
|
||||
Logs.debug('msvc: lib found: %s', os.path.join(path,libn))
|
||||
return re.sub('\.lib$', '',libn)
|
||||
return re.sub(r'\.lib$', '',libn)
|
||||
|
||||
#if no lib can be found, just return the libname as msvc expects it
|
||||
self.fatal('The library %r could not be found' % libname)
|
||||
return re.sub('\.lib$', '', libname)
|
||||
return re.sub(r'\.lib$', '', libname)
|
||||
|
||||
@conf
|
||||
def check_lib_msvc(self, libname, is_static=False, uselib_store=None):
|
||||
|
@ -305,7 +305,7 @@ def process_mocs(self):
|
||||
@feature('qt5')
|
||||
@after_method('apply_link')
|
||||
def apply_qt5(self):
|
||||
"""
|
||||
r"""
|
||||
Adds MOC_FLAGS which may be necessary for moc::
|
||||
|
||||
def build(bld):
|
||||
@ -762,7 +762,7 @@ def set_qt5_libs_to_check(self):
|
||||
if self.environ.get('QT5_FORCE_STATIC'):
|
||||
pat = self.env.cxxstlib_PATTERN
|
||||
if Utils.unversioned_sys_platform() == 'darwin':
|
||||
pat = "%s\.framework"
|
||||
pat = r"%s\.framework"
|
||||
re_qt = re.compile(pat%'Qt5?(?P<name>.*)'+'$')
|
||||
for x in dirlst:
|
||||
m = re_qt.match(x)
|
||||
|
@ -24,8 +24,8 @@ def rc_file(self, node):
|
||||
self.compiled_tasks = [rctask]
|
||||
|
||||
re_lines = re.compile(
|
||||
'(?:^[ \t]*(#|%:)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef|pragma)[ \t]*(.*?)\s*$)|'\
|
||||
'(?:^\w+[ \t]*(ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)[ \t]*(.*?)\s*$)',
|
||||
r'(?:^[ \t]*(#|%:)[ \t]*(ifdef|ifndef|if|else|elif|endif|include|import|define|undef|pragma)[ \t]*(.*?)\s*$)|'\
|
||||
r'(?:^\w+[ \t]*(ICON|BITMAP|CURSOR|HTML|FONT|MESSAGETABLE|TYPELIB|REGISTRY|D3DFX)[ \t]*(.*?)\s*$)',
|
||||
re.IGNORECASE | re.MULTILINE)
|
||||
|
||||
class rc_parser(c_preproc.c_parser):
|
||||
|
@ -736,7 +736,7 @@ def unversioned_sys_platform():
|
||||
if s == 'cli' and os.name == 'nt':
|
||||
# ironpython is only on windows as far as we know
|
||||
return 'win32'
|
||||
return re.split('\d+$', s)[0]
|
||||
return re.split(r'\d+$', s)[0]
|
||||
|
||||
def nada(*k, **kw):
|
||||
"""
|
||||
|
@ -264,7 +264,7 @@ else:
|
||||
'u': pop_cursor,
|
||||
}
|
||||
# Match either the escape sequence or text not containing escape sequence
|
||||
ansi_tokens = re.compile('(?:\x1b\[([0-9?;]*)([a-zA-Z])|([^\x1b]+))')
|
||||
ansi_tokens = re.compile(r'(?:\x1b\[([0-9?;]*)([a-zA-Z])|([^\x1b]+))')
|
||||
def write(self, text):
|
||||
try:
|
||||
wlock.acquire()
|
||||
|
6
waflib/extras/cpplint.py
vendored
6
waflib/extras/cpplint.py
vendored
@ -43,12 +43,12 @@ from waflib import Errors, Task, TaskGen, Logs, Options, Node, Utils
|
||||
|
||||
critical_errors = 0
|
||||
CPPLINT_FORMAT = '[CPPLINT] %(filename)s:\nline %(linenum)s, severity %(confidence)s, category: %(category)s\n%(message)s\n'
|
||||
RE_EMACS = re.compile('(?P<filename>.*):(?P<linenum>\d+): (?P<message>.*) \[(?P<category>.*)\] \[(?P<confidence>\d+)\]')
|
||||
RE_EMACS = re.compile(r'(?P<filename>.*):(?P<linenum>\d+): (?P<message>.*) \[(?P<category>.*)\] \[(?P<confidence>\d+)\]')
|
||||
CPPLINT_RE = {
|
||||
'waf': RE_EMACS,
|
||||
'emacs': RE_EMACS,
|
||||
'vs7': re.compile('(?P<filename>.*)\((?P<linenum>\d+)\): (?P<message>.*) \[(?P<category>.*)\] \[(?P<confidence>\d+)\]'),
|
||||
'eclipse': re.compile('(?P<filename>.*):(?P<linenum>\d+): warning: (?P<message>.*) \[(?P<category>.*)\] \[(?P<confidence>\d+)\]'),
|
||||
'vs7': re.compile(r'(?P<filename>.*)\((?P<linenum>\d+)\): (?P<message>.*) \[(?P<category>.*)\] \[(?P<confidence>\d+)\]'),
|
||||
'eclipse': re.compile(r'(?P<filename>.*):(?P<linenum>\d+): warning: (?P<message>.*) \[(?P<category>.*)\] \[(?P<confidence>\d+)\]'),
|
||||
}
|
||||
CPPLINT_STR = ('${CPPLINT} '
|
||||
'--verbose=${CPPLINT_LEVEL} '
|
||||
|
@ -44,7 +44,7 @@ TARFORMAT = 'w:bz2'
|
||||
TIMEOUT = 60
|
||||
REQUIRES = 'requires.txt'
|
||||
|
||||
re_com = re.compile('\s*#.*', re.M)
|
||||
re_com = re.compile(r'\s*#.*', re.M)
|
||||
|
||||
def total_version_order(num):
|
||||
lst = num.split('.')
|
||||
|
@ -51,7 +51,7 @@ class erl(Task.Task):
|
||||
if n.abspath() in scanned:
|
||||
continue
|
||||
|
||||
for i in re.findall('-include\("(.*)"\)\.', n.read()):
|
||||
for i in re.findall(r'-include\("(.*)"\)\.', n.read()):
|
||||
for d in task.erlc_incnodes:
|
||||
r = d.find_node(i)
|
||||
if r:
|
||||
|
@ -36,7 +36,7 @@ def scan(self):
|
||||
names = []
|
||||
return (nodes, names)
|
||||
|
||||
re_o = re.compile("\.o$")
|
||||
re_o = re.compile(r"\.o$")
|
||||
re_splitter = re.compile(r'(?<!\\)\s+') # split by space, except when spaces are escaped
|
||||
|
||||
def remove_makefile_rule_lhs(line):
|
||||
|
@ -71,7 +71,7 @@ def configure(self):
|
||||
fu = re.compile('#(.*)\n')
|
||||
txt = fu.sub('', txt)
|
||||
|
||||
setregexp = re.compile('([sS][eE][tT]\s*\()\s*([^\s]+)\s+\"([^"]+)\"\)')
|
||||
setregexp = re.compile(r'([sS][eE][tT]\s*\()\s*([^\s]+)\s+\"([^"]+)\"\)')
|
||||
found = setregexp.findall(txt)
|
||||
|
||||
for (_, key, val) in found:
|
||||
|
@ -15,7 +15,7 @@ EXT_MLI = ['.mli']
|
||||
EXT_MLC = ['.c']
|
||||
EXT_ML = ['.ml']
|
||||
|
||||
open_re = re.compile('^\s*open\s+([a-zA-Z]+)(;;){0,1}$', re.M)
|
||||
open_re = re.compile(r'^\s*open\s+([a-zA-Z]+)(;;){0,1}$', re.M)
|
||||
foo = re.compile(r"""(\(\*)|(\*\))|("(\\.|[^"\\])*"|'(\\.|[^'\\])*'|.[^()*"'\\]*)""", re.M)
|
||||
def filter_comments(txt):
|
||||
meh = [0]
|
||||
|
@ -60,7 +60,7 @@ def get_pgi_version(conf, cc):
|
||||
except Errors.WafError:
|
||||
conf.fatal('Could not find pgi compiler %r' % cmd)
|
||||
|
||||
version = re.findall('^COMPVER\s*=(.*)', out, re.M)
|
||||
version = re.findall(r'^COMPVER\s*=(.*)', out, re.M)
|
||||
if len(version) != 1:
|
||||
conf.fatal('Could not determine the compiler version')
|
||||
return version[0]
|
||||
|
@ -108,7 +108,7 @@ def add_pylang(self, node):
|
||||
|
||||
@feature('pyqt5')
|
||||
def apply_pyqt5(self):
|
||||
"""
|
||||
r"""
|
||||
The additional parameters are:
|
||||
|
||||
:param lang: list of translation files (\*.ts) to process
|
||||
|
@ -282,7 +282,7 @@ def add_lang(self, node):
|
||||
@feature('qt4')
|
||||
@after_method('apply_link')
|
||||
def apply_qt4(self):
|
||||
"""
|
||||
r"""
|
||||
Add MOC_FLAGS which may be necessary for moc::
|
||||
|
||||
def build(bld):
|
||||
|
@ -203,7 +203,7 @@ class remote(BuildContext):
|
||||
Options.commands.remove(k)
|
||||
|
||||
def login_to_host(self, login):
|
||||
return re.sub('(\w+@)', '', login)
|
||||
return re.sub(r'(\w+@)', '', login)
|
||||
|
||||
def variant_to_login(self, variant):
|
||||
"""linux_32_debug -> search env.LINUX_32 and then env.LINUX"""
|
||||
|
@ -101,7 +101,7 @@ class run_do_script(run_do_script_base):
|
||||
with open(**kwargs) as log:
|
||||
log_tail = log.readlines()[-10:]
|
||||
for line in log_tail:
|
||||
error_found = re.match("r\(([0-9]+)\)", line)
|
||||
error_found = re.match(r"r\(([0-9]+)\)", line)
|
||||
if error_found:
|
||||
return error_found.group(1), ''.join(log_tail)
|
||||
else:
|
||||
|
@ -17,10 +17,10 @@ tasks have to be added dynamically:
|
||||
|
||||
SWIG_EXTS = ['.swig', '.i']
|
||||
|
||||
re_module = re.compile('%module(?:\s*\(.*\))?\s+(.+)', re.M)
|
||||
re_module = re.compile(r'%module(?:\s*\(.*\))?\s+(.+)', re.M)
|
||||
|
||||
re_1 = re.compile(r'^%module.*?\s+([\w]+)\s*?$', re.M)
|
||||
re_2 = re.compile('[#%](?:include|import(?:\(module=".*"\))+|python(?:begin|code)) [<"](.*)[">]', re.M)
|
||||
re_2 = re.compile(r'[#%](?:include|import(?:\(module=".*"\))+|python(?:begin|code)) [<"](.*)[">]', re.M)
|
||||
|
||||
class swig(Task.Task):
|
||||
color = 'BLUE'
|
||||
|
Loading…
Reference in New Issue
Block a user