Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions uv/private/extension.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -509,10 +509,11 @@ def _raw_whl_repos(_module_ctx, lock_specs, override_specs):
def _sbuild_repo_name(hub, venv, package):
"""Get the repo name for a sdist build."""

return "sbuild__{}__{}__{}".format(
return "sbuild__{}__{}__{}__{}".format(
hub,
venv,
package["name"],
package["sdist"]["hash"][len("sha256:"):][:8],
)

def _venv_target(hub_name, venv, package_name):
Expand Down Expand Up @@ -563,10 +564,20 @@ def _sbuild_repos(_module_ctx, lock_specs, annotation_specs, override_specs):
def _whl_install_repo_name(hub, venv, package):
"""Get the whl install repo name for a given package."""

return "whl_install__{}__{}__{}".format(
# Prefer sdist hash for consistency, fall back to first wheel hash
if "sdist" in package:
hash_val = package["sdist"]["hash"][len("sha256:"):][:8]
elif "wheels" in package and package["wheels"]:
hash_val = package["wheels"][0]["hash"][len("sha256:"):][:8]
else:
# This should never happen based on lockfile validation, but be defensive
hash_val = sha1("{}__{}__{}".format(hub, venv, package["name"]))[:8]

return "whl_install__{}__{}__{}__{}".format(
hub,
venv,
package["name"],
hash_val,
)

# TODO: Move this to a real library
Expand Down