MCPcopy Index your code
hub / github.com/RustPython/RustPython / is_up_to_date

Function is_up_to_date

scripts/update_lib/deps.py:1049–1081  ·  view source on GitHub ↗

Check if a module is up-to-date by comparing files. Args: name: Module name cpython_prefix: CPython directory prefix lib_prefix: Local Lib directory prefix Returns: True if all files match, False otherwise

(name: str, cpython_prefix: str, lib_prefix: str)

Source from the content-addressed store, hash-verified

1047
1048@functools.cache
1049def is_up_to_date(name: str, cpython_prefix: str, lib_prefix: str) -> bool:
1050 """Check if a module is up-to-date by comparing files.
1051
1052 Args:
1053 name: Module name
1054 cpython_prefix: CPython directory prefix
1055 lib_prefix: Local Lib directory prefix
1056
1057 Returns:
1058 True if all files match, False otherwise
1059 """
1060 lib_paths = get_lib_paths(name, cpython_prefix)
1061
1062 found_any = False
1063 for cpython_path in lib_paths:
1064 if not cpython_path.exists():
1065 continue
1066
1067 found_any = True
1068
1069 # Convert cpython path to local path
1070 # cpython/Lib/foo.py -> Lib/foo.py
1071 rel_path = cpython_path.relative_to(cpython_prefix)
1072 local_path = pathlib.Path(lib_prefix) / rel_path.relative_to("Lib")
1073
1074 if not compare_paths(cpython_path, local_path):
1075 return False
1076
1077 if not found_any:
1078 dep_info = DEPENDENCIES.get(name, {})
1079 if dep_info.get("lib") == []:
1080 return True
1081 return found_any
1082
1083
1084def _count_file_diff(file_a: pathlib.Path, file_b: pathlib.Path) -> int:

Callers 4

compute_todo_listFunction · 0.90
format_all_todoFunction · 0.90
format_deps_treeFunction · 0.90

Calls 5

compare_pathsFunction · 0.90
get_lib_pathsFunction · 0.85
existsMethod · 0.45
relative_toMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected