(argv: list[str] | None = None)
| 323 | |
| 324 | |
| 325 | def main(argv: list[str] | None = None) -> int: |
| 326 | parser = argparse.ArgumentParser( |
| 327 | description=__doc__, |
| 328 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 329 | ) |
| 330 | parser.add_argument( |
| 331 | "path", |
| 332 | type=pathlib.Path, |
| 333 | help="Source path (file or directory)", |
| 334 | ) |
| 335 | parser.add_argument( |
| 336 | "--copy", |
| 337 | action=argparse.BooleanOptionalAction, |
| 338 | default=True, |
| 339 | help="Copy library file (default: enabled, implied disabled if test path)", |
| 340 | ) |
| 341 | parser.add_argument( |
| 342 | "--migrate", |
| 343 | action=argparse.BooleanOptionalAction, |
| 344 | default=True, |
| 345 | help="Migrate test file (default: enabled, implied disabled if Lib/ path)", |
| 346 | ) |
| 347 | parser.add_argument( |
| 348 | "--auto-mark", |
| 349 | action=argparse.BooleanOptionalAction, |
| 350 | default=True, |
| 351 | help="Auto-mark test failures (default: enabled)", |
| 352 | ) |
| 353 | parser.add_argument( |
| 354 | "--mark-failure", |
| 355 | action="store_true", |
| 356 | help="Add @expectedFailure to failing tests", |
| 357 | ) |
| 358 | parser.add_argument( |
| 359 | "--commit", |
| 360 | action=argparse.BooleanOptionalAction, |
| 361 | default=True, |
| 362 | help="Create git commit (default: enabled)", |
| 363 | ) |
| 364 | parser.add_argument( |
| 365 | "--build", |
| 366 | action=argparse.BooleanOptionalAction, |
| 367 | default=True, |
| 368 | help="Build with cargo (default: enabled)", |
| 369 | ) |
| 370 | |
| 371 | args = parser.parse_args(argv) |
| 372 | |
| 373 | try: |
| 374 | src_path = args.path |
| 375 | |
| 376 | # Shortcut: expand simple name to cpython/Lib path |
| 377 | src_path = _expand_shortcut(src_path) |
| 378 | original_src = src_path # Keep for commit |
| 379 | |
| 380 | # Track library path for commit |
| 381 | lib_file_path = None |
| 382 | test_path = None |
no test coverage detected