1From bcba27168d99a3919b730e6a533cf79ab3b24eee Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Micka=C3=ABl=20Schoentgen?= <contact@tiger-222.fr>
3Date: Sat, 5 Jan 2019 12:02:42 +0100
4Subject: [PATCH] Fix all DeprecationWarning: invalid escape sequence
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9Signed-off-by: Mickaël Schoentgen <contact@tiger-222.fr>
10---
11Upstream-Status: Backport [from waflib not jack: https://gitlab.com/ita1024/waf/-/commit/412a9b819e86a0061f990c7245f0f5db76d0eda3]
12
13 waflib/Build.py           |  2 +-
14 waflib/ConfigSet.py       |  2 +-
15 waflib/Context.py         |  2 +-
16 waflib/Task.py            |  2 +-
17 waflib/TaskGen.py         |  2 +-
18 waflib/Tools/c_config.py  |  2 +-
19 waflib/Tools/c_preproc.py |  6 +++---
20 waflib/Tools/msvc.py      | 16 ++++++++--------
21 waflib/Utils.py           |  2 +-
22 waflib/ansiterm.py        |  2 +-
23 10 files changed, 19 insertions(+), 19 deletions(-)
24
25diff --git a/waflib/Build.py b/waflib/Build.py
26index c9661df1..9e733c9e 100644
27--- a/waflib/Build.py
28+++ b/waflib/Build.py
29@@ -104,7 +104,7 @@ class BuildContext(Context.Context):
30 		"""Amount of jobs to run in parallel"""
31
32 		self.targets = Options.options.targets
33-		"""List of targets to build (default: \*)"""
34+		"""List of targets to build (default: \\*)"""
35
36 		self.keep = Options.options.keep
37 		"""Whether the build should continue past errors"""
38diff --git a/waflib/ConfigSet.py b/waflib/ConfigSet.py
39index 84736c9c..901fba6c 100644
40--- a/waflib/ConfigSet.py
41+++ b/waflib/ConfigSet.py
42@@ -11,7 +11,7 @@ The values put in :py:class:`ConfigSet` must be serializable (dicts, lists, stri
43
44 import copy, re, os
45 from waflib import Logs, Utils
46-re_imp = re.compile('^(#)*?([^#=]*?)\ =\ (.*?)$', re.M)
47+re_imp = re.compile(r'^(#)*?([^#=]*?)\ =\ (.*?)$', re.M)
48
49 class ConfigSet(object):
50 	"""
51diff --git a/waflib/Context.py b/waflib/Context.py
52index 38ab03f1..5799a60a 100644
53--- a/waflib/Context.py
54+++ b/waflib/Context.py
55@@ -614,7 +614,7 @@ class Context(ctx):
56 		Logs.pprint(color, msg)
57
58 	def load_special_tools(self, var, ban=[]):
59-		"""
60+		r"""
61 		Loads third-party extensions modules for certain programming languages
62 		by trying to list certain files in the extras/ directory. This method
63 		is typically called once for a programming language group, see for
64diff --git a/waflib/Task.py b/waflib/Task.py
65index 6aebc607..0c5cb994 100644
66--- a/waflib/Task.py
67+++ b/waflib/Task.py
68@@ -1044,7 +1044,7 @@ def funex(c):
69 	exec(c, dc)
70 	return dc['f']
71
72-re_cond = re.compile('(?P<var>\w+)|(?P<or>\|)|(?P<and>&)')
73+re_cond = re.compile(r'(?P<var>\w+)|(?P<or>\|)|(?P<and>&)')
74 re_novar = re.compile(r'^(SRC|TGT)\W+.*?$')
75 reg_act = re.compile(r'(?P<backslash>\\)|(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})', re.M)
76 def compile_fun_shell(line):
77diff --git a/waflib/TaskGen.py b/waflib/TaskGen.py
78index a74e6431..3776bac1 100644
79--- a/waflib/TaskGen.py
80+++ b/waflib/TaskGen.py
81@@ -727,7 +727,7 @@ def sequence_order(self):
82 	self.bld.prev = self
83
84
85-re_m4 = re.compile('@(\w+)@', re.M)
86+re_m4 = re.compile(r'@(\w+)@', re.M)
87
88 class subst_pc(Task.Task):
89 	"""
90diff --git a/waflib/Tools/c_config.py b/waflib/Tools/c_config.py
91index d2b3c0d8..60cc0ecd 100644
92--- a/waflib/Tools/c_config.py
93+++ b/waflib/Tools/c_config.py
94@@ -239,7 +239,7 @@ def validate_cfg(self, kw):
95
96 @conf
97 def exec_cfg(self, kw):
98-	"""
99+	r"""
100 	Executes ``pkg-config`` or other ``-config`` applications to collect configuration flags:
101
102 	* if atleast_pkgconfig_version is given, check that pkg-config has the version n and return
103diff --git a/waflib/Tools/c_preproc.py b/waflib/Tools/c_preproc.py
104index 7e04b4a7..68e5f5ae 100644
105--- a/waflib/Tools/c_preproc.py
106+++ b/waflib/Tools/c_preproc.py
107@@ -75,13 +75,13 @@ re_lines = re.compile(
108 	re.IGNORECASE | re.MULTILINE)
109 """Match #include lines"""
110
111-re_mac = re.compile("^[a-zA-Z_]\w*")
112+re_mac = re.compile(r"^[a-zA-Z_]\w*")
113 """Match macro definitions"""
114
115 re_fun = re.compile('^[a-zA-Z_][a-zA-Z0-9_]*[(]')
116 """Match macro functions"""
117
118-re_pragma_once = re.compile('^\s*once\s*', re.IGNORECASE)
119+re_pragma_once = re.compile(r'^\s*once\s*', re.IGNORECASE)
120 """Match #pragma once statements"""
121
122 re_nl = re.compile('\\\\\r*\n', re.MULTILINE)
123@@ -660,7 +660,7 @@ def extract_macro(txt):
124 			# empty define, assign an empty token
125 			return (v, [[], [('T','')]])
126
127-re_include = re.compile('^\s*(<(?:.*)>|"(?:.*)")')
128+re_include = re.compile(r'^\s*(<(?:.*)>|"(?:.*)")')
129 def extract_include(txt, defs):
130 	"""
131 	Process a line in the form::
132diff --git a/waflib/Tools/msvc.py b/waflib/Tools/msvc.py
133index 17b347d4..ff58449d 100644
134--- a/waflib/Tools/msvc.py
135+++ b/waflib/Tools/msvc.py
136@@ -281,7 +281,7 @@ def gather_wince_supported_platforms():
137
138 def gather_msvc_detected_versions():
139 	#Detected MSVC versions!
140-	version_pattern = re.compile('^(\d\d?\.\d\d?)(Exp)?$')
141+	version_pattern = re.compile(r'^(\d\d?\.\d\d?)(Exp)?$')
142 	detected_versions = []
143 	for vcver,vcvar in (('VCExpress','Exp'), ('VisualStudio','')):
144 		prefix = 'SOFTWARE\\Wow6432node\\Microsoft\\' + vcver
145@@ -367,7 +367,7 @@ def gather_wsdk_versions(conf, versions):
146 	:param versions: list to modify
147 	:type versions: list
148 	"""
149-	version_pattern = re.compile('^v..?.?\...?.?')
150+	version_pattern = re.compile(r'^v..?.?\...?.?')
151 	try:
152 		all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows')
153 	except OSError:
154@@ -525,7 +525,7 @@ def gather_icl_versions(conf, versions):
155 	:param versions: list to modify
156 	:type versions: list
157 	"""
158-	version_pattern = re.compile('^...?.?\....?.?')
159+	version_pattern = re.compile(r'^...?.?\....?.?')
160 	try:
161 		all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++')
162 	except OSError:
163@@ -579,7 +579,7 @@ def gather_intel_composer_versions(conf, versions):
164 	:param versions: list to modify
165 	:type versions: list
166 	"""
167-	version_pattern = re.compile('^...?.?\...?.?.?')
168+	version_pattern = re.compile(r'^...?.?\...?.?.?')
169 	try:
170 		all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Suites')
171 	except OSError:
172@@ -683,7 +683,7 @@ def find_lt_names_msvc(self, libname, is_static=False):
173 				if not is_static and ltdict.get('library_names', ''):
174 					dllnames=ltdict['library_names'].split()
175 					dll=dllnames[0].lower()
176-					dll=re.sub('\.dll$', '', dll)
177+					dll=re.sub(r'\.dll$', '', dll)
178 					return (lt_libdir, dll, False)
179 				elif ltdict.get('old_library', ''):
180 					olib=ltdict['old_library']
181@@ -700,7 +700,7 @@ def find_lt_names_msvc(self, libname, is_static=False):
182 @conf
183 def libname_msvc(self, libname, is_static=False):
184 	lib = libname.lower()
185-	lib = re.sub('\.lib$','',lib)
186+	lib = re.sub(r'\.lib$','',lib)
187
188 	if lib in g_msvc_systemlibs:
189 		return lib
190@@ -747,11 +747,11 @@ def libname_msvc(self, libname, is_static=False):
191 		for libn in libnames:
192 			if os.path.exists(os.path.join(path, libn)):
193 				Logs.debug('msvc: lib found: %s', os.path.join(path,libn))
194-				return re.sub('\.lib$', '',libn)
195+				return re.sub(r'\.lib$', '',libn)
196
197 	#if no lib can be found, just return the libname as msvc expects it
198 	self.fatal('The library %r could not be found' % libname)
199-	return re.sub('\.lib$', '', libname)
200+	return re.sub(r'\.lib$', '', libname)
201
202 @conf
203 def check_lib_msvc(self, libname, is_static=False, uselib_store=None):
204diff --git a/waflib/Utils.py b/waflib/Utils.py
205index a0cc2a09..da1b73e7 100644
206--- a/waflib/Utils.py
207+++ b/waflib/Utils.py
208@@ -730,7 +730,7 @@ def unversioned_sys_platform():
209 	if s == 'cli' and os.name == 'nt':
210 		# ironpython is only on windows as far as we know
211 		return 'win32'
212-	return re.split('\d+$', s)[0]
213+	return re.split(r'\d+$', s)[0]
214
215 def nada(*k, **kw):
216 	"""
217diff --git a/waflib/ansiterm.py b/waflib/ansiterm.py
218index 0d20c637..027f0ad6 100644
219--- a/waflib/ansiterm.py
220+++ b/waflib/ansiterm.py
221@@ -264,7 +264,7 @@ else:
222 			'u': pop_cursor,
223 		}
224 		# Match either the escape sequence or text not containing escape sequence
225-		ansi_tokens = re.compile('(?:\x1b\[([0-9?;]*)([a-zA-Z])|([^\x1b]+))')
226+		ansi_tokens = re.compile(r'(?:\x1b\[([0-9?;]*)([a-zA-Z])|([^\x1b]+))')
227 		def write(self, text):
228 			try:
229 				wlock.acquire()
230