Skip to content

Commit

Permalink
fix: always use simplist form if on PATH
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Apr 12, 2024
1 parent c7f07b5 commit 2be661b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion nox/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,23 @@


def find_uv() -> tuple[bool, str]:
uv_on_path = shutil.which("uv")

# Look for uv in Nox's environment, to handle `pipx install nox[uv]`.
with contextlib.suppress(ImportError, FileNotFoundError):
from uv import find_uv_bin
uv_bin = find_uv_bin()

if uv_on_path and Path(uv_bin).samefile(uv_on_path):
return True, "uv"

return True, find_uv_bin()

# Fall back to PATH.
if shutil.which("uv") is not None:
return True, "uv"

return False, "uv"
return uv_on_path is not None, "uv"


HAS_UV, UV = find_uv()
Expand Down

0 comments on commit 2be661b

Please sign in to comment.