raw string literals are next to godliness

Invalid escape sequences are deprecated and will be removed from a
future version of python. Use r"" to define them so they remain
readable.
pull/8475/head
Eli Schwartz 4 years ago
parent fb59529458
commit 76df995ba6
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 4
      mesonbuild/compilers/cuda.py
  2. 2
      mesonbuild/mcompile.py
  3. 4
      mesonbuild/scripts/depscan.py
  4. 2
      run_unittests.py

@ -186,7 +186,7 @@ class CudaCompiler(Compiler):
@classmethod
def _shield_nvcc_list_arg(cls, arg: str, listmode: bool=True) -> str:
"""
r"""
Shield an argument against both splitting by NVCC's list-argument
parse logic, and interpretation by any shell.
@ -256,7 +256,7 @@ class CudaCompiler(Compiler):
# Shield individual strings, without listmode, then return them with
# escaped commas between them.
l = [cls._shield_nvcc_list_arg(s, listmode=False) for s in l]
return '\,'.join(l)
return r'\,'.join(l)
@classmethod
def _to_host_flags(cls, flags: T.List[str], phase: _Phase = _Phase.COMPILER) -> T.List[str]:

@ -175,7 +175,7 @@ def generate_target_name_vs(target: ParsedTargetName, builddir: Path, introspect
# Normalize project name
# Source: https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe
target_name = re.sub('[\%\$\@\;\.\(\)\']', '_', intro_target['id']) # type: str
target_name = re.sub(r"[\%\$\@\;\.\(\)']", '_', intro_target['id']) # type: str
rel_path = Path(intro_target['filename'][0]).relative_to(builddir.resolve()).parent
if rel_path != Path('.'):
target_name = str(rel_path / target_name)

@ -22,8 +22,8 @@ import typing as T
from ..backend.ninjabackend import TargetDependencyScannerInfo, ninja_quote
from ..compilers.compilers import lang_suffixes
CPP_IMPORT_RE = re.compile('\w*import ([a-zA-Z0-9]+);')
CPP_EXPORT_RE = re.compile('\w*export module ([a-zA-Z0-9]+);')
CPP_IMPORT_RE = re.compile(r'\w*import ([a-zA-Z0-9]+);')
CPP_EXPORT_RE = re.compile(r'\w*export module ([a-zA-Z0-9]+);')
FORTRAN_INCLUDE_PAT = r"^\s*include\s*['\"](\w+\.\w+)['\"]"
FORTRAN_MODULE_PAT = r"^\s*\bmodule\b\s+(\w+)\s*(?:!+.*)*$"

@ -5893,7 +5893,7 @@ class FailureTests(BasePlatformTests):
def test_error_func(self):
self.assertMesonRaises("error('a', 'b', ['c', ['d', {'e': 'f'}]], 'g')",
"Problem encountered: a b \['c', \['d', {'e' : 'f'}\]\] g")
r"Problem encountered: a b \['c', \['d', {'e' : 'f'}\]\] g")
@unittest.skipUnless(is_windows() or is_cygwin(), "requires Windows (or Windows via Cygwin)")

Loading…
Cancel
Save