Get all library paths for a module. Args: name: Module name (e.g., "datetime", "libregrtest") cpython_prefix: CPython directory prefix Returns: Tuple of paths to copy
(name: str, cpython_prefix: str)
| 884 | |
| 885 | @functools.cache |
| 886 | def get_lib_paths(name: str, cpython_prefix: str) -> tuple[pathlib.Path, ...]: |
| 887 | """Get all library paths for a module. |
| 888 | |
| 889 | Args: |
| 890 | name: Module name (e.g., "datetime", "libregrtest") |
| 891 | cpython_prefix: CPython directory prefix |
| 892 | |
| 893 | Returns: |
| 894 | Tuple of paths to copy |
| 895 | """ |
| 896 | dep_info = DEPENDENCIES.get(name, {}) |
| 897 | |
| 898 | # Get main lib path (override or default) |
| 899 | if "lib" in dep_info: |
| 900 | paths = [construct_lib_path(cpython_prefix, p) for p in dep_info["lib"]] |
| 901 | else: |
| 902 | # Default: try file first, then directory |
| 903 | paths = [resolve_module_path(name, cpython_prefix, prefer="file")] |
| 904 | |
| 905 | # Add hard_deps from DEPENDENCIES |
| 906 | for dep in dep_info.get("hard_deps", []): |
| 907 | paths.append(construct_lib_path(cpython_prefix, dep)) |
| 908 | |
| 909 | # Auto-detect _py{module}.py or _py_{module}.py patterns |
| 910 | for pattern in [f"_py{name}.py", f"_py_{name}.py"]: |
| 911 | auto_path = construct_lib_path(cpython_prefix, pattern) |
| 912 | if auto_path.exists() and auto_path not in paths: |
| 913 | paths.append(auto_path) |
| 914 | |
| 915 | return tuple(paths) |
| 916 | |
| 917 | |
| 918 | def get_all_hard_deps(name: str, cpython_prefix: str) -> list[str]: |