Bug 1872343 - Use r-strings or escape backslashes to prevent SyntaxWarning: invalid escape sequence r=jcristau

Differential Revision: https://phabricator.services.mozilla.com/D197417
This commit is contained in:
serge-sans-paille 2024-01-02 08:54:44 +00:00
Родитель 3b5280be4f
Коммит 5a2f7b26e2
7 изменённых файлов: 20 добавлений и 20 удалений

Просмотреть файл

@ -471,9 +471,9 @@ class ArtifactJob(object):
if "esr" in version_display or "esr" in source_repo:
return self.esr_candidate_trees
elif re.search("a\d+$", version_display):
elif re.search(r"a\d+$", version_display):
return self.nightly_candidate_trees
elif re.search("b\d+$", version_display):
elif re.search(r"b\d+$", version_display):
return self.beta_candidate_trees
return self.default_candidate_trees

Просмотреть файл

@ -120,7 +120,7 @@ DEPRECATED_VARIABLES_MESSAGE = (
def make_quote(s):
return s.replace("#", "\#").replace("$", "$$")
return s.replace("#", r"\#").replace("$", "$$")
class BackendMakeFile(object):
@ -1002,7 +1002,7 @@ class RecursiveMakeBackend(MakeBackend):
if t not in content:
continue
if t == "tools" and not re.search(
"(?:^|\s)tools.*::", content, re.M
r"(?:^|\s)tools.*::", content, re.M
):
continue
if objdir == self.environment.topobjdir:
@ -1013,7 +1013,7 @@ class RecursiveMakeBackend(MakeBackend):
# Directories with a Makefile containing a check target
# can't be skipped and must run during the 'check' tier.
if re.search("(?:^|\s)check.*::", content, re.M):
if re.search(r"(?:^|\s)check.*::", content, re.M):
self._no_skip["check"].add(
mozpath.relpath(objdir, self.environment.topobjdir)
)

Просмотреть файл

@ -2179,7 +2179,7 @@ VARIABLES = {
"""Names of example WebIDL interfaces to build as part of the build.
Names in this list correspond to WebIDL interface names defined in
WebIDL files included in the build from one of the \*WEBIDL_FILES
WebIDL files included in the build from one of the *WEBIDL_FILES
variables.
""",
),

Просмотреть файл

@ -98,26 +98,26 @@ class DeprecatedJarManifest(Exception):
class JarManifestParser(object):
ignore = re.compile("\s*(\#.*)?$")
ignore = re.compile(r"\s*(#.*)?$")
jarline = re.compile(
"""
r"""
(?:
(?:\[(?P<base>[\w\d.\-\_\\\/{}@]+)\]\s*)? # optional [base/path]
(?P<jarfile>[\w\d.\-\_\\\/{}]+).jar\: # filename.jar:
(?:\[(?P<base>[\w\d.\-_\/{}@]+)\]\s*)? # optional [base/path]
(?P<jarfile>[\w\d.\-_\/{}]+)\.jar: # filename.jar:
|
(?:\s*(\#.*)?) # comment
)\s*$ # whitespaces
(?:\s*(\#.*)?) # comment
)\s*$ # whitespaces
""",
re.VERBOSE,
)
relsrcline = re.compile("relativesrcdir\s+(?P<relativesrcdir>.+?):")
regline = re.compile("\%\s+(.*)$")
entryre = "(?P<optPreprocess>\*)?(?P<optOverwrite>\+?)\s+"
relsrcline = re.compile(r"relativesrcdir\s+(?P<relativesrcdir>.+?):")
regline = re.compile(r"%\s+(.*)$")
entryre = r"(?P<optPreprocess>\*)?(?P<optOverwrite>\+?)\s+"
entryline = re.compile(
entryre
+ (
"(?P<output>[\w\d.\-\_\\\/\+\@]+)\s*"
"(\((?P<locale>\%?)(?P<source>[\w\d.\-\_\\\/\@\*]+)\))?\s*$"
r"(?P<output>[\w\d.\-\_\/+@]+)\s*"
r"(\((?P<locale>%?)(?P<source>[\w\d.\-\_\/@*]+)\))?\s*$"
)
)

Просмотреть файл

@ -106,7 +106,7 @@ class Component(object):
component = splits[0].strip()
if not component:
raise ValueError("No component found")
if not re.match("[a-zA-Z0-9_\-]+$", component):
if not re.match("[a-zA-Z0-9_-]+$", component):
raise ValueError("Bad component name " + component)
options = Component._split_options(splits[1]) if len(splits) > 1 else {}
return component, options

Просмотреть файл

@ -162,7 +162,7 @@ elif processor == "Power Macintosh":
elif processor == "arm" and bits == "64bit":
processor = "aarch64"
bits = re.search("(\d+)bit", bits).group(1)
bits = re.search(r"(\d+)bit", bits).group(1)
info.update(
{
"processor": processor,

Просмотреть файл

@ -238,7 +238,7 @@ def uninstall(install_folder):
if os.path.isfile(log_file):
trbk = None
try:
cmdArgs = ["%s\\uninstall\helper.exe" % install_folder, "/S"]
cmdArgs = ["%s\\uninstall\\helper.exe" % install_folder, "/S"]
result = subprocess.call(cmdArgs)
if result != 0:
raise Exception("Execution of uninstaller failed.")