MCPcopy
hub / github.com/pyodide/pyodide / get_lockfile_path

Function get_lockfile_path

tools/create_lockfile_diff.py:131–160  ·  view source on GitHub ↗

Get the path to a lockfile, downloading it if necessary. Args: path_or_url: Path or URL to the lockfile, or None to auto-detect. is_old: Whether this is the old lockfile (True) or new lockfile (False). temp_dir: Temporary directory for downloads. Returns:

(path_or_url: str | None, is_old: bool, temp_dir: Path)

Source from the content-addressed store, hash-verified

129
130
131def get_lockfile_path(path_or_url: str | None, is_old: bool, temp_dir: Path) -> Path:
132 """
133 Get the path to a lockfile, downloading it if necessary.
134
135 Args:
136 path_or_url: Path or URL to the lockfile, or None to auto-detect.
137 is_old: Whether this is the old lockfile (True) or new lockfile (False).
138 temp_dir: Temporary directory for downloads.
139
140 Returns:
141 Path to the lockfile.
142 """
143 if path_or_url is None:
144 # Auto-detect based on whether it's old or new
145 if is_old:
146 print(
147 "Auto-detecting old lockfile from upstream/main branch...",
148 file=sys.stderr,
149 )
150 url = get_lockfile_url_from_makefile("upstream/main")
151 else:
152 print("Auto-detecting new lockfile from current branch...", file=sys.stderr)
153 url = get_lockfile_url_from_makefile(None)
154 return download_lockfile(url, temp_dir / ("old" if is_old else "new"))
155 elif path_or_url.startswith("http://") or path_or_url.startswith("https://"):
156 # It's a URL, download it
157 return download_lockfile(path_or_url, temp_dir / ("old" if is_old else "new"))
158 else:
159 # It's a local path
160 return Path(path_or_url)
161
162
163def calculate_diff(

Callers 1

mainFunction · 0.85

Calls 2

download_lockfileFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…