mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
find uv binary relative to package root (#4336)
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:
- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->
## Summary
[ruff's `find_bin`
implementation](19cd9d7d8a/python/ruff/__main__.py (L31)
)
can find the binary in relative to the package root. It'd be nice to
have the same functionality for `uv`.
This commit is contained in:
parent
294f0e0c41
commit
5752817494
1 changed files with 6 additions and 0 deletions
|
@ -27,6 +27,12 @@ def find_uv_bin() -> str:
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
return path
|
return path
|
||||||
|
|
||||||
|
# Search in `bin` adjacent to package root (as created by `pip install --target`).
|
||||||
|
pkg_root = os.path.dirname(os.path.dirname(__file__))
|
||||||
|
target_path = os.path.join(pkg_root, "bin", uv_exe)
|
||||||
|
if os.path.isfile(target_path):
|
||||||
|
return target_path
|
||||||
|
|
||||||
raise FileNotFoundError(path)
|
raise FileNotFoundError(path)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue