gh-104780: Remove 2to3 program and lib2to3 module (#104781)

* Remove the Tools/scripts/2to3 script.
* Remove the Lib/test/test_lib2to3/ directory.
* Doc/tools/extensions/pyspecific.py: remove the "2to3fixer" object
  type.
* Makefile and PC/layout/main.py no longer compile lib2to3 grammar
  files.
* Update Makefile for 2to3 removal.
This commit is contained in:
Victor Stinner 2023-05-23 19:40:02 +02:00 committed by GitHub
parent ddb1485953
commit ae00b810d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
135 changed files with 26 additions and 21000 deletions

View file

@ -49,8 +49,6 @@
REQUIRED_DLLS = FileStemSet("libcrypto*", "libssl*", "libffi*")
LIB2TO3_GRAMMAR_FILES = FileNameSet("Grammar.txt", "PatternGrammar.txt")
PY_FILES = FileSuffixSet(".py")
PYC_FILES = FileSuffixSet(".pyc")
CAT_FILES = FileSuffixSet(".cat")
@ -298,27 +296,6 @@ def _write_to_zip(zf, dest, src, ns, checked=True):
log_exception("Failed to delete {}", pyc)
return
if src in LIB2TO3_GRAMMAR_FILES:
from lib2to3.pgen2.driver import load_grammar
tmp = ns.temp / src.name
try:
shutil.copy(src, tmp)
load_grammar(str(tmp))
for f in ns.temp.glob(src.stem + "*.pickle"):
zf.write(str(f), str(dest.parent / f.name))
try:
f.unlink()
except:
log_exception("Failed to delete {}", f)
except:
log_exception("Failed to compile {}", src)
finally:
try:
tmp.unlink()
except:
log_exception("Failed to delete {}", tmp)
zf.write(str(src), str(dest))