summaryrefslogtreecommitdiff
path: root/Tools/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-xTools/scripts/combinerefs.py4
-rwxr-xr-xTools/scripts/diff.py2
-rwxr-xr-xTools/scripts/fixdiv.py4
-rw-r--r--Tools/scripts/generate_opcode_h.py2
-rwxr-xr-xTools/scripts/h2py.py8
-rwxr-xr-xTools/scripts/highlight.py16
-rwxr-xr-xTools/scripts/idle32
-rwxr-xr-xTools/scripts/mailerdaemon.py2
-rwxr-xr-xTools/scripts/nm2def.py4
-rwxr-xr-xTools/scripts/parseentities.py4
-rwxr-xr-xTools/scripts/pathfix.py2
-rwxr-xr-xTools/scripts/ptags.py2
-rwxr-xr-xTools/scripts/pyvenv6
-rwxr-xr-xTools/scripts/svneol.py2
-rwxr-xr-xTools/scripts/texi2html.py10
15 files changed, 37 insertions, 33 deletions
diff --git a/Tools/scripts/combinerefs.py b/Tools/scripts/combinerefs.py
index e10e49ad7c..7ca95267c9 100755
--- a/Tools/scripts/combinerefs.py
+++ b/Tools/scripts/combinerefs.py
@@ -6,7 +6,7 @@ combinerefs path
A helper for analyzing PYTHONDUMPREFS output.
When the PYTHONDUMPREFS envar is set in a debug build, at Python shutdown
-time Py_Finalize() prints the list of all live objects twice: first it
+time Py_FinalizeEx() prints the list of all live objects twice: first it
prints the repr() of each object while the interpreter is still fully intact.
After cleaning up everything it can, it prints all remaining live objects
again, but the second time just prints their addresses, refcounts, and type
@@ -41,7 +41,7 @@ CAUTION: If object is a container type, it may not actually contain all the
objects shown in the repr: the repr was captured from the first output block,
and some of the containees may have been released since then. For example,
it's common for the line showing the dict of interned strings to display
-strings that no longer exist at the end of Py_Finalize; this can be recognized
+strings that no longer exist at the end of Py_FinalizeEx; this can be recognized
(albeit painfully) because such containees don't have a line of their own.
The objects are listed in allocation order, with most-recently allocated
diff --git a/Tools/scripts/diff.py b/Tools/scripts/diff.py
index 9720a43155..96199b8511 100755
--- a/Tools/scripts/diff.py
+++ b/Tools/scripts/diff.py
@@ -8,7 +8,7 @@
"""
-import sys, os, time, difflib, argparse
+import sys, os, difflib, argparse
from datetime import datetime, timezone
def file_mtime(path):
diff --git a/Tools/scripts/fixdiv.py b/Tools/scripts/fixdiv.py
index 20f33865e2..1213a4e397 100755
--- a/Tools/scripts/fixdiv.py
+++ b/Tools/scripts/fixdiv.py
@@ -174,8 +174,8 @@ def usage(msg):
sys.stderr.write("Usage: %s [-m] warnings\n" % sys.argv[0])
sys.stderr.write("Try `%s -h' for more information.\n" % sys.argv[0])
-PATTERN = ("^(.+?):(\d+): DeprecationWarning: "
- "classic (int|long|float|complex) division$")
+PATTERN = (r"^(.+?):(\d+): DeprecationWarning: "
+ r"classic (int|long|float|complex) division$")
def readwarnings(warningsfile):
prog = re.compile(PATTERN)
diff --git a/Tools/scripts/generate_opcode_h.py b/Tools/scripts/generate_opcode_h.py
index c62f9a5b23..948b56f900 100644
--- a/Tools/scripts/generate_opcode_h.py
+++ b/Tools/scripts/generate_opcode_h.py
@@ -1,7 +1,5 @@
# This script generates the opcode.h header file.
-from __future__ import with_statement
-
import sys
header = """/* Auto-generated by Tools/scripts/generate_opcode_h.py */
#ifndef Py_OPCODE_H
diff --git a/Tools/scripts/h2py.py b/Tools/scripts/h2py.py
index 0967fc29d6..4363c0cf73 100755
--- a/Tools/scripts/h2py.py
+++ b/Tools/scripts/h2py.py
@@ -23,13 +23,13 @@
import sys, re, getopt, os
-p_define = re.compile('^[\t ]*#[\t ]*define[\t ]+([a-zA-Z0-9_]+)[\t ]+')
+p_define = re.compile(r'^[\t ]*#[\t ]*define[\t ]+([a-zA-Z0-9_]+)[\t ]+')
p_macro = re.compile(
- '^[\t ]*#[\t ]*define[\t ]+'
- '([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[\t ]+')
+ r'^[\t ]*#[\t ]*define[\t ]+'
+ r'([a-zA-Z0-9_]+)\(([_a-zA-Z][_a-zA-Z0-9]*)\)[\t ]+')
-p_include = re.compile('^[\t ]*#[\t ]*include[\t ]+<([^>\n]+)>')
+p_include = re.compile(r'^[\t ]*#[\t ]*include[\t ]+<([^>\n]+)>')
p_comment = re.compile(r'/\*([^*]+|\*+[^/])*(\*+/)?')
p_cpp_comment = re.compile('//.*')
diff --git a/Tools/scripts/highlight.py b/Tools/scripts/highlight.py
index 66ad868ec3..9272fee4ee 100755
--- a/Tools/scripts/highlight.py
+++ b/Tools/scripts/highlight.py
@@ -147,14 +147,14 @@ def build_html_page(classified_text, title='python',
#### LaTeX Output ##########################################
default_latex_commands = {
- 'comment': '{\color{red}#1}',
- 'string': '{\color{ForestGreen}#1}',
- 'docstring': '{\emph{\color{ForestGreen}#1}}',
- 'keyword': '{\color{orange}#1}',
- 'builtin': '{\color{purple}#1}',
- 'definition': '{\color{orange}#1}',
- 'defname': '{\color{blue}#1}',
- 'operator': '{\color{brown}#1}',
+ 'comment': r'{\color{red}#1}',
+ 'string': r'{\color{ForestGreen}#1}',
+ 'docstring': r'{\emph{\color{ForestGreen}#1}}',
+ 'keyword': r'{\color{orange}#1}',
+ 'builtin': r'{\color{purple}#1}',
+ 'definition': r'{\color{orange}#1}',
+ 'defname': r'{\color{blue}#1}',
+ 'operator': r'{\color{brown}#1}',
}
default_latex_document = r'''
diff --git a/Tools/scripts/idle3 b/Tools/scripts/idle3
index 8ee92c2afe..d7332bca48 100755
--- a/Tools/scripts/idle3
+++ b/Tools/scripts/idle3
@@ -1,5 +1,5 @@
#! /usr/bin/env python3
-from idlelib.PyShell import main
+from idlelib.pyshell import main
if __name__ == '__main__':
main()
diff --git a/Tools/scripts/mailerdaemon.py b/Tools/scripts/mailerdaemon.py
index aeb451e942..635e5482e6 100755
--- a/Tools/scripts/mailerdaemon.py
+++ b/Tools/scripts/mailerdaemon.py
@@ -88,7 +88,7 @@ del i
# no more expressions are searched for. So, order is important.
emparse_list_reason = [
r'^5\d{2} <>\.\.\. (?P<reason>.*)',
- '<>\.\.\. (?P<reason>.*)',
+ r'<>\.\.\. (?P<reason>.*)',
re.compile(r'^<<< 5\d{2} (?P<reason>.*)', re.MULTILINE),
re.compile('===== stderr was =====\nrmail: (?P<reason>.*)'),
re.compile('^Diagnostic-Code: (?P<reason>.*)', re.MULTILINE),
diff --git a/Tools/scripts/nm2def.py b/Tools/scripts/nm2def.py
index 8f07559e21..83bbcd749f 100755
--- a/Tools/scripts/nm2def.py
+++ b/Tools/scripts/nm2def.py
@@ -36,8 +36,8 @@ option to produce this format (since it is the original v7 Unix format).
"""
import os, sys
-PYTHONLIB = 'libpython'+sys.version[:3]+'.a'
-PC_PYTHONLIB = 'Python'+sys.version[0]+sys.version[2]+'.dll'
+PYTHONLIB = 'libpython%d.%d.a' % sys.version_info[:2]
+PC_PYTHONLIB = 'Python%d%d.dll' % sys.version_info[:2]
NM = 'nm -p -g %s' # For Linux, use "nm -g %s"
def symbols(lib=PYTHONLIB,types=('T','C','D')):
diff --git a/Tools/scripts/parseentities.py b/Tools/scripts/parseentities.py
index a042d1c24c..c686b0241a 100755
--- a/Tools/scripts/parseentities.py
+++ b/Tools/scripts/parseentities.py
@@ -14,7 +14,7 @@
"""
import re,sys
-entityRE = re.compile('<!ENTITY +(\w+) +CDATA +"([^"]+)" +-- +((?:.|\n)+?) *-->')
+entityRE = re.compile(r'<!ENTITY +(\w+) +CDATA +"([^"]+)" +-- +((?:.|\n)+?) *-->')
def parse(text,pos=0,endpos=None):
@@ -39,7 +39,7 @@ def writefile(f,defs):
if charcode[:2] == '&#':
code = int(charcode[2:-1])
if code < 256:
- charcode = "'\%o'" % code
+ charcode = r"'\%o'" % code
else:
charcode = repr(charcode)
else:
diff --git a/Tools/scripts/pathfix.py b/Tools/scripts/pathfix.py
index 22432d1639..562bbc7378 100755
--- a/Tools/scripts/pathfix.py
+++ b/Tools/scripts/pathfix.py
@@ -64,7 +64,7 @@ def main():
if fix(arg): bad = 1
sys.exit(bad)
-ispythonprog = re.compile('^[a-zA-Z0-9_]+\.py$')
+ispythonprog = re.compile(r'^[a-zA-Z0-9_]+\.py$')
def ispython(name):
return bool(ispythonprog.match(name))
diff --git a/Tools/scripts/ptags.py b/Tools/scripts/ptags.py
index ca643b3494..396cbd07ea 100755
--- a/Tools/scripts/ptags.py
+++ b/Tools/scripts/ptags.py
@@ -24,7 +24,7 @@ def main():
for s in tags: fp.write(s)
-expr = '^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:\(]'
+expr = r'^[ \t]*(def|class)[ \t]+([a-zA-Z0-9_]+)[ \t]*[:\(]'
matcher = re.compile(expr)
def treat_file(filename):
diff --git a/Tools/scripts/pyvenv b/Tools/scripts/pyvenv
index 978d691d1e..1fb42c6391 100755
--- a/Tools/scripts/pyvenv
+++ b/Tools/scripts/pyvenv
@@ -1,6 +1,12 @@
#!/usr/bin/env python3
if __name__ == '__main__':
import sys
+ import pathlib
+
+ executable = pathlib.Path(sys.executable or 'python3').name
+ print('WARNING: the pyenv script is deprecated in favour of '
+ f'`{executable} -m venv`', file=sys.stderr)
+
rc = 1
try:
import venv
diff --git a/Tools/scripts/svneol.py b/Tools/scripts/svneol.py
index 8abdd01529..6c70da9692 100755
--- a/Tools/scripts/svneol.py
+++ b/Tools/scripts/svneol.py
@@ -1,6 +1,6 @@
#! /usr/bin/env python3
-"""
+r"""
SVN helper script.
Try to set the svn:eol-style property to "native" on every .py, .txt, .c and
diff --git a/Tools/scripts/texi2html.py b/Tools/scripts/texi2html.py
index 99835280fe..9c1e9fe8d8 100755
--- a/Tools/scripts/texi2html.py
+++ b/Tools/scripts/texi2html.py
@@ -78,11 +78,11 @@ spprog = re.compile('[\n@{}&<>]') # Special characters in
# running text
#
# menu item (Yuck!)
-miprog = re.compile('^\* ([^:]*):(:|[ \t]*([^\t,\n.]+)([^ \t\n]*))[ \t\n]*')
-# 0 1 1 2 3 34 42 0
-# ----- ---------- ---------
-# -|-----------------------------
-# -----------------------------------------------------
+miprog = re.compile(r'^\* ([^:]*):(:|[ \t]*([^\t,\n.]+)([^ \t\n]*))[ \t\n]*')
+# 0 1 1 2 3 34 42 0
+# ----- ---------- ---------
+# -|-----------------------------
+# -----------------------------------------------------