Skip to content

Commit

Permalink
Handle run_tests.py removal in Python 3.13
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Jun 6, 2024
1 parent c8abcae commit 805c76f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion cpython-unix/build-cpython.sh
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,9 @@ cp -av Python/frozen.c ${ROOT}/out/python/build/Python/
cp -av Modules/Setup* ${ROOT}/out/python/build/Modules/

# Copy the test hardness runner for convenience.
cp -av Tools/scripts/run_tests.py ${ROOT}/out/python/build/
if [ -d Tools/scripts/run_tests.py ]; then
cp -av Tools/scripts/run_tests.py ${ROOT}/out/python/build/
fi

mkdir ${ROOT}/out/python/licenses
cp ${ROOT}/LICENSE.*.txt ${ROOT}/out/python/licenses/
16 changes: 12 additions & 4 deletions cpython-windows/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 805c76f

Please sign in to comment.