From d77c1585baced062bf2f64b65854af4552a694e9 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 5 Jun 2024 19:57:12 -0500 Subject: [PATCH] Handle `run_tests.py` removal in Python 3.13 --- cpython-windows/build.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/cpython-windows/build.py b/cpython-windows/build.py index bc97cd57..f7a4ebd2 100644 --- a/cpython-windows/build.py +++ b/cpython-windows/build.py @@ -1700,10 +1700,18 @@ def build_cpython( log("copying %s to %s" % (source, dest)) shutil.copyfile(source, dest) - shutil.copyfile( - cpython_source_path / "Tools" / "scripts" / "run_tests.py", - out_dir / "python" / "build" / "run_tests.py", - ) + # CPython 3.13 removed `run_tests.py`. + if meets_python_minimum_version(python_version, "3.13"): + # TODO(zanieb): Write a script to invoke `python -m test --slow-ci` + # or update the metadata to not require `run_tests.py` + pathlib.Path( + out_dir / "python" / "build" / "run_tests.py", + ).touch() + else: + shutil.copyfile( + cpython_source_path / "Tools" / "scripts" / "run_tests.py", + out_dir / "python" / "build" / "run_tests.py", + ) licenses_dir = out_dir / "python" / "licenses" licenses_dir.mkdir()