diff options
author | Victor Stinner <vstinner@python.org> | 2023-05-23 17:40:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-23 17:40:02 (GMT) |
commit | ae00b810d1d3ad7f1f7e226b02ece37c986330e7 (patch) | |
tree | 173ec10e86e887adad8740e7833c92a464779917 /PC/layout | |
parent | ddb14859535ab8091381b9d0baf32dbe245b5e65 (diff) | |
download | cpython-ae00b810d1d3ad7f1f7e226b02ece37c986330e7.zip cpython-ae00b810d1d3ad7f1f7e226b02ece37c986330e7.tar.gz cpython-ae00b810d1d3ad7f1f7e226b02ece37c986330e7.tar.bz2 |
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.
Diffstat (limited to 'PC/layout')
-rw-r--r-- | PC/layout/main.py | 23 | ||||
-rw-r--r-- | PC/layout/support/props.py | 2 | ||||
-rw-r--r-- | PC/layout/support/python.props | 2 |
3 files changed, 0 insertions, 27 deletions
diff --git a/PC/layout/main.py b/PC/layout/main.py index c924600..cb2e487 100644 --- a/PC/layout/main.py +++ b/PC/layout/main.py @@ -49,8 +49,6 @@ EXCLUDE_FROM_CATALOG = FileSuffixSet(".exe", ".pyd", ".dll") 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)) diff --git a/PC/layout/support/props.py b/PC/layout/support/props.py index c7a7a0c..f751a4b 100644 --- a/PC/layout/support/props.py +++ b/PC/layout/support/props.py @@ -36,7 +36,6 @@ PROPS_TEMPLATE = r"""<?xml version="1.0" encoding="utf-8"?> <PythonVersion>{PYTHON_VERSION}</PythonVersion> <IncludePythonExe Condition="$(IncludePythonExe) == ''">true</IncludePythonExe> - <IncludeLib2To3 Condition="$(IncludeLib2To3) == ''">false</IncludeLib2To3> <IncludeVEnv Condition="$(IncludeVEnv) == ''">false</IncludeVEnv> <GetPythonRuntimeFilesDependsOn>{PYTHON_TARGET};$(GetPythonRuntimeFilesDependsOn)</GetPythonRuntimeFilesDependsOn> @@ -67,7 +66,6 @@ PROPS_TEMPLATE = r"""<?xml version="1.0" encoding="utf-8"?> <Link>DLLs\%(Filename)%(Extension)</Link> </_PythonRuntimeDlls> <_PythonRuntimeLib Include="$(PythonHome)\Lib\**\*" Exclude="$(PythonHome)\Lib\**\*.pyc;$(PythonHome)\Lib\site-packages\**\*" /> - <_PythonRuntimeLib Remove="$(PythonHome)\Lib\lib2to3\**\*" Condition="$(IncludeLib2To3) != 'true'" /> <_PythonRuntimeLib Remove="$(PythonHome)\Lib\ensurepip\**\*" Condition="$(IncludeVEnv) != 'true'" /> <_PythonRuntimeLib Remove="$(PythonHome)\Lib\venv\**\*" Condition="$(IncludeVEnv) != 'true'" /> <_PythonRuntimeLib> diff --git a/PC/layout/support/python.props b/PC/layout/support/python.props index e46891a..c48ecb2 100644 --- a/PC/layout/support/python.props +++ b/PC/layout/support/python.props @@ -8,7 +8,6 @@ <PythonVersion>$$PYTHON_VERSION$$</PythonVersion> <IncludePythonExe Condition="$(IncludePythonExe) == ''">true</IncludePythonExe> - <IncludeLib2To3 Condition="$(IncludeLib2To3) == ''">false</IncludeLib2To3> <IncludeVEnv Condition="$(IncludeVEnv) == ''">false</IncludeVEnv> <GetPythonRuntimeFilesDependsOn>$$PYTHON_TARGET$$;$(GetPythonRuntimeFilesDependsOn)</GetPythonRuntimeFilesDependsOn> @@ -40,7 +39,6 @@ <Link>DLLs\%(Filename)%(Extension)</Link> </_PythonRuntimeDlls> <_PythonRuntimeLib Include="$(PythonHome)\Lib\**\*" Exclude="$(PythonHome)\Lib\**\*.pyc;$(PythonHome)\Lib\site-packages\**\*" /> - <_PythonRuntimeLib Remove="$(PythonHome)\Lib\lib2to3\**\*" Condition="$(IncludeLib2To3) != 'true'" /> <_PythonRuntimeLib Remove="$(PythonHome)\Lib\ensurepip\**\*" Condition="$(IncludeVEnv) != 'true'" /> <_PythonRuntimeLib Remove="$(PythonHome)\Lib\venv\**\*" Condition="$(IncludeVEnv) != 'true'" /> <_PythonRuntimeLib> |