Commit fe41e077 authored by R David Murray's avatar R David Murray

#27364: fix "incorrect" uses of escape character in the stdlib.

And most of the tools.

Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and
Martin Panter.
parent fe96d2a5
...@@ -221,7 +221,7 @@ class Command: ...@@ -221,7 +221,7 @@ class Command:
self._ensure_stringlike(option, "string", default) self._ensure_stringlike(option, "string", default)
def ensure_string_list(self, option): def ensure_string_list(self, option):
"""Ensure that 'option' is a list of strings. If 'option' is r"""Ensure that 'option' is a list of strings. If 'option' is
currently a string, we split it either on /,\s*/ or /\s+/, so currently a string, we split it either on /,\s*/ or /\s+/, so
"foo bar baz", "foo,bar,baz", and "foo, bar baz" all become "foo bar baz", "foo,bar,baz", and "foo, bar baz" all become
["foo", "bar", "baz"]. ["foo", "bar", "baz"].
......
...@@ -623,7 +623,7 @@ class bdist_msi(Command): ...@@ -623,7 +623,7 @@ class bdist_msi(Command):
cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title, cost = PyDialog(db, "DiskCostDlg", x, y, w, h, modal, title,
"OK", "OK", "OK", bitmap=False) "OK", "OK", "OK", bitmap=False)
cost.text("Title", 15, 6, 200, 15, 0x30003, cost.text("Title", 15, 6, 200, 15, 0x30003,
"{\DlgFontBold8}Disk Space Requirements") r"{\DlgFontBold8}Disk Space Requirements")
cost.text("Description", 20, 20, 280, 20, 0x30003, cost.text("Description", 20, 20, 280, 20, 0x30003,
"The disk space required for the installation of the selected features.") "The disk space required for the installation of the selected features.")
cost.text("Text", 20, 53, 330, 60, 3, cost.text("Text", 20, 53, 330, 60, 3,
...@@ -670,7 +670,7 @@ class bdist_msi(Command): ...@@ -670,7 +670,7 @@ class bdist_msi(Command):
progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title, progress = PyDialog(db, "ProgressDlg", x, y, w, h, modeless, title,
"Cancel", "Cancel", "Cancel", bitmap=False) "Cancel", "Cancel", "Cancel", bitmap=False)
progress.text("Title", 20, 15, 200, 15, 0x30003, progress.text("Title", 20, 15, 200, 15, 0x30003,
"{\DlgFontBold8}[Progress1] [ProductName]") r"{\DlgFontBold8}[Progress1] [ProductName]")
progress.text("Text", 35, 65, 300, 30, 3, progress.text("Text", 35, 65, 300, 30, 3,
"Please wait while the Installer [Progress2] [ProductName]. " "Please wait while the Installer [Progress2] [ProductName]. "
"This may take several minutes.") "This may take several minutes.")
......
...@@ -51,7 +51,7 @@ class build_scripts(Command): ...@@ -51,7 +51,7 @@ class build_scripts(Command):
def copy_scripts(self): def copy_scripts(self):
"""Copy each script listed in 'self.scripts'; if it's marked as a r"""Copy each script listed in 'self.scripts'; if it's marked as a
Python script in the Unix way (first line matches 'first_line_re', Python script in the Unix way (first line matches 'first_line_re',
ie. starts with "\#!" and contains "python"), then adjust the first ie. starts with "\#!" and contains "python"), then adjust the first
line to refer to the current Python interpreter as we copy. line to refer to the current Python interpreter as we copy.
......
...@@ -368,7 +368,7 @@ def check_config_h(): ...@@ -368,7 +368,7 @@ def check_config_h():
return (CONFIG_H_UNCERTAIN, return (CONFIG_H_UNCERTAIN,
"couldn't read '%s': %s" % (fn, exc.strerror)) "couldn't read '%s': %s" % (fn, exc.strerror))
RE_VERSION = re.compile(b'(\d+\.\d+(\.\d+)*)') RE_VERSION = re.compile(br'(\d+\.\d+(\.\d+)*)')
def _find_exe_version(cmd): def _find_exe_version(cmd):
"""Find the version of an executable by running `cmd` in the shell. """Find the version of an executable by running `cmd` in the shell.
......
...@@ -716,7 +716,7 @@ class MSVCCompiler(CCompiler) : ...@@ -716,7 +716,7 @@ class MSVCCompiler(CCompiler) :
r"""VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)""", r"""VC\d{2}\.CRT("|').*?(/>|</assemblyIdentity>)""",
re.DOTALL) re.DOTALL)
manifest_buf = re.sub(pattern, "", manifest_buf) manifest_buf = re.sub(pattern, "", manifest_buf)
pattern = "<dependentAssembly>\s*</dependentAssembly>" pattern = r"<dependentAssembly>\s*</dependentAssembly>"
manifest_buf = re.sub(pattern, "", manifest_buf) manifest_buf = re.sub(pattern, "", manifest_buf)
# Now see if any other assemblies are referenced - if not, we # Now see if any other assemblies are referenced - if not, we
# don't want a manifest embedded. # don't want a manifest embedded.
......
...@@ -278,7 +278,7 @@ def parse_config_h(fp, g=None): ...@@ -278,7 +278,7 @@ def parse_config_h(fp, g=None):
# Regexes needed for parsing Makefile (and similar syntaxes, # Regexes needed for parsing Makefile (and similar syntaxes,
# like old-style Setup files). # like old-style Setup files).
_variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)") _variable_rx = re.compile(r"([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)")
_findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)")
_findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}")
......
...@@ -154,7 +154,7 @@ def split_provision(value): ...@@ -154,7 +154,7 @@ def split_provision(value):
global _provision_rx global _provision_rx
if _provision_rx is None: if _provision_rx is None:
_provision_rx = re.compile( _provision_rx = re.compile(
"([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$", r"([a-zA-Z_]\w*(?:\.[a-zA-Z_]\w*)*)(?:\s*\(\s*([^)\s]+)\s*\))?$",
re.ASCII) re.ASCII)
value = value.strip() value = value.strip()
m = _provision_rx.match(value) m = _provision_rx.match(value)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment