Skip to content
Merged
Show file tree
Hide file tree
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
22 changes: 21 additions & 1 deletion uv/private/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,24 @@
load("@with_cfg.bzl", "with_cfg")
load("//py:defs.bzl", "py_library")

py_whl_library, _ = with_cfg(py_library).set(Label("//uv/private/constraints:lib_mode"), "whl").build()
LIB_MODE = "//uv/private/constraints:lib_mode"

py_whl_library, _ = with_cfg(py_library).set(Label(LIB_MODE), "whl").build()

def _lib_mode_transition_impl(settings, attr):
return {LIB_MODE: "lib"}

lib_mode_transition = transition(
implementation = _lib_mode_transition_impl,
inputs = [],
outputs = [LIB_MODE],
)

def _whl_mode_transition_impl(settings, attr):
return {LIB_MODE: "whl"}

whl_mode_transition = transition(
implementation = _whl_mode_transition_impl,
inputs = [],
outputs = [LIB_MODE],
)
10 changes: 10 additions & 0 deletions uv/private/sdist_build/rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ load("//py/private/py_venv:types.bzl", "VirtualenvInfo")

# buildifier: disable=bzl-visibility
load("//py/private/toolchain:types.bzl", "PY_TOOLCHAIN")
load("//uv/private:defs.bzl", "lib_mode_transition")

TAR_TOOLCHAIN = "@tar.bzl//tar/toolchain:type"
# UV_TOOLCHAIN = "@multitool//tools/uv:toolchain_type"
Expand Down Expand Up @@ -102,4 +103,13 @@ specified Python dependencies under the configured Python toochain.
# UV_TOOLCHAIN,
# FIXME: Add in a cc toolchain here
],
# KLUDGE: Reset the uv lib mode and force it to lib. This ensures that if
# the user requests a library graph as whl files instead of libraries AND we
# have to do an sdist build to create one of those whls, the sdist builds
# required to produce those whls will occur with their dependencies
# _installed as libraries_ rather than _present as whl files_.
#
# Otherwise the transitive deps of the venv will still be in whl mode and we
# get cool errors that `build` and other tools aren't installed.
cfg = lib_mode_transition,
)
Loading