Download the specified URL into the given directory. :return: The path to the downloaded archive.
(url: str, target_dir: Path)
| 339 | |
| 340 | |
| 341 | def download(url: str, target_dir: Path) -> Path: |
| 342 | """Download the specified URL into the given directory. |
| 343 | |
| 344 | :return: The path to the downloaded archive. |
| 345 | """ |
| 346 | target_path = Path(target_dir).resolve() |
| 347 | target_path.mkdir(exist_ok=True, parents=True) |
| 348 | |
| 349 | out_path = target_path / basename(url) |
| 350 | if not Path(out_path).is_file(): |
| 351 | run([ |
| 352 | "curl", |
| 353 | "-Lf", |
| 354 | "--retry", |
| 355 | "5", |
| 356 | "--retry-all-errors", |
| 357 | "-o", |
| 358 | out_path, |
| 359 | url, |
| 360 | ]) |
| 361 | else: |
| 362 | print(f"Using cached version of {basename(url)}") |
| 363 | return out_path |
| 364 | |
| 365 | |
| 366 | def configure_host_python( |