Unverified Commit 46c59525 authored by André Silva's avatar André Silva
Browse files

rustPlatform.fetchCargoVendor: use static.crates.io in v2

parent 8209ba2b
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -69,7 +69,9 @@ def get_download_url_for_tarball(pkg: dict[str, Any]) -> str:
    if pkg["source"] != "registry+https://github.com/rust-lang/crates.io-index":
        raise Exception("Only the default crates.io registry is supported.")

    return f"https://crates.io/api/v1/crates/{pkg["name"]}/{pkg["version"]}/download"
    # Use static.crates.io (CDN) instead of crates.io/api to avoid the 1 req/sec
    # rate limit on the API servers.
    return f"https://static.crates.io/crates/{pkg["name"]}/{pkg["version"]}/download"


def download_tarball(session: requests.Session, pkg: dict[str, Any], out_dir: Path) -> None: