contextlib2/dev/save_diff_snapshot.sh
Nick Coghlan c223508344 Sync with CPython 3.12.3
Also adds some helper scripts for the sync process

Closes #43
2024-05-23 16:55:15 +10:00

27 lines
824 B
Bash
Executable file

#!/bin/sh
git_root="$(git rev-parse --show-toplevel)"
cpython_dir="${1:-$git_root/../cpython}"
diff_prefix="py3_12" # Update based on the version being synced
function diff_file()
{
diff -ud "$2" "$git_root/$3" > "$git_root/dev/${diff_prefix}_$1.patch"
}
diff_file rst_to_contextlib2 \
"$cpython_dir/Doc/library/contextlib.rst" "docs/contextlib2.rst"
diff_file py_to_contextlib2 \
"$cpython_dir/Lib/contextlib.py" "contextlib2/__init__.py"
diff_file pyi_to_contextlib2 \
"$git_root/dev/typeshed_contextlib.pyi" "contextlib2/__init__.pyi"
diff_file test_to_contextlib2 \
"$cpython_dir/Lib/test/test_contextlib.py" "test/test_contextlib.py"
diff_file test_async_to_contextlib2 \
"$cpython_dir/Lib/test/test_contextlib_async.py" "test/test_contextlib_async.py"