Closed as not planned
Description
I have almost finished preparing a uv package for Fedora. As written, the uv.find_uv_bin() Python function would not be able to find the executable /usr/bin/uv that this package would provide:
- First it checks which evaluates to
Line 13 in 2288ff7
/usr/local/bin/uv. - Then it checks where
Line 26 in 2288ff7
user_schemeis"posix_user", which evaluates to '/home/myusername/.local/bin/uv'. - Then it checks which evaluates to something like
Lines 31 to 32 in 2288ff7
/usr/lib/python3.13/bin/uvor/usr/lib64/python3.13/bin/uv. (I currently get the latter, but since theuvPython library is actually arch-independent when it doesn’t bundle theuvexecutable, I should probably ensure it’s the former.)
I should be able to fix this by something like:
diff --git a/python/uv/__init__.py b/python/uv/__init__.py
index 781eee4f..f2603785 100644
--- a/python/uv/__init__.py
+++ b/python/uv/__init__.py
@@ -10,6 +10,12 @@ def find_uv_bin() -> str:
uv_exe = "uv" + sysconfig.get_config_var("EXE")
+ bindir_path = sysconfig.get_config_var("BINDIR")
+ if bindir_path is not None:
+ path = os.path.join(bindir_path, uv_exe)
+ if os.path.isfile(path):
+ return path
+
path = os.path.join(sysconfig.get_path("scripts"), uv_exe)
if os.path.isfile(path):
return pathor, probably better,
diff --git a/python/uv/__init__.py b/python/uv/__init__.py
index 781eee4f..80953b2e 100644
--- a/python/uv/__init__.py
+++ b/python/uv/__init__.py
@@ -1,6 +1,7 @@
from __future__ import annotations
import os
+import shutil
import sys
import sysconfig
@@ -10,6 +11,10 @@ def find_uv_bin() -> str:
uv_exe = "uv" + sysconfig.get_config_var("EXE")
+ path = shutil.which(uv_exe)
+ if path is not None:
+ return path
+
path = os.path.join(sysconfig.get_path("scripts"), uv_exe)
if os.path.isfile(path):
return pathIs this a change that you think belongs in uv upstream, or is this something I should carry as a downstream patch?