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)
| 129 | |
| 130 | |
| 131 | def 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 | |
| 163 | def calculate_diff( |
no test coverage detected
searching dependent graphs…