Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix migrate resolve
  • Loading branch information
youknowone committed Jan 24, 2026
commit 7cfcb08e882c2dc4f8c354842cc0bfcc63bf2af2
60 changes: 46 additions & 14 deletions scripts/update_lib/quick.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
sys.path.insert(0, str(pathlib.Path(__file__).parent.parent))

from update_lib.io_utils import safe_read_text
from update_lib.deps import get_test_paths
from update_lib.path import (
construct_lib_path,
get_module_name,
Expand Down Expand Up @@ -206,7 +207,7 @@ def get_cpython_version(cpython_dir: pathlib.Path) -> str:
def git_commit(
name: str,
lib_path: pathlib.Path | None,
test_path: pathlib.Path | None,
test_paths: list[pathlib.Path] | pathlib.Path | None,
cpython_dir: pathlib.Path,
verbose: bool = True,
) -> bool:
Expand All @@ -215,7 +216,7 @@ def git_commit(
Args:
name: Module name (e.g., "dataclasses")
lib_path: Path to library file/directory (or None)
test_path: Path to test file/directory (or None)
test_paths: Path(s) to test file/directory (or None)
cpython_dir: Path to cpython directory
verbose: Print progress messages

Expand All @@ -224,12 +225,19 @@ def git_commit(
"""
import subprocess

# Normalize test_paths to list
if test_paths is None:
test_paths = []
elif isinstance(test_paths, pathlib.Path):
test_paths = [test_paths]

# Stage changes
paths_to_add = []
if lib_path and lib_path.exists():
paths_to_add.append(str(lib_path))
if test_path and test_path.exists():
paths_to_add.append(str(test_path))
for test_path in test_paths:
if test_path and test_path.exists():
paths_to_add.append(str(test_path))

if not paths_to_add:
return False
Expand Down Expand Up @@ -380,32 +388,56 @@ def main(argv: list[str] | None = None) -> int:

copy_lib(src_path)

# Convert to test path
src_path = lib_to_test_path(original_src)
if not src_path.exists():
print(f"Warning: Test path does not exist: {src_path}")
# Skip test processing, but continue with commit
src_path = None

if src_path is not None:
# Get all test paths from DEPENDENCIES (or fall back to default)
module_name = get_module_name(original_src)
cpython_dir = get_cpython_dir(original_src)
test_src_paths = get_test_paths(module_name, str(cpython_dir))

# Fall back to default test path if DEPENDENCIES has no entry
if not test_src_paths:
default_test = lib_to_test_path(original_src)
if default_test.exists():
test_src_paths = (default_test,)

# Process all test paths
test_paths_for_commit = []
for test_src in test_src_paths:
if not test_src.exists():
print(f"Warning: Test path does not exist: {test_src}")
continue

test_lib_path = parse_lib_path(test_src)
test_paths_for_commit.append(test_lib_path)

quick(
test_src,
no_migrate=not args.migrate,
no_auto_mark=not args.auto_mark,
mark_failure=args.mark_failure,
skip_build=not args.build,
)

test_paths = test_paths_for_commit
else:
# It's a test path - process single test
test_path = (
parse_lib_path(src_path) if not is_lib_path(src_path) else src_path
)

# Process the test path
quick(
src_path,
no_migrate=not args.migrate,
no_auto_mark=not args.auto_mark,
mark_failure=args.mark_failure,
skip_build=not args.build,
)
test_paths = [test_path]

# Step 3: Git commit
if args.commit:
cpython_dir = get_cpython_dir(original_src)
git_commit(
get_module_name(original_src), lib_file_path, test_path, cpython_dir
get_module_name(original_src), lib_file_path, test_paths, cpython_dir
)

return 0
Expand Down