autoupdate: Add support for upgrading editable tool (#3140)

pull/3141/head
patryk4815 6 months ago committed by GitHub
parent 5a6491228f
commit 9200ae4b87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -23,8 +23,15 @@ def hash_file(file_path: str | Path) -> str:
def run_uv_install( def run_uv_install(
binary_path: os.PathLike[str], src_root: Path, dev: bool = False binary_path: os.PathLike[str], src_root: Path, venv_path: Path, dev: bool = False
) -> Tuple[str, str, int]: ) -> Tuple[str, str, int]:
# Check if the package was installed using: `uv tool install --editable .[lldb,gdb]`
# Tools are located at: ${HOME}/.local/share/uv/tools/${TOOL_NAME}/uv-receipt.toml
is_tool_install = (venv_path / "uv-receipt.toml").exists()
if is_tool_install:
tool_name = venv_path.name
command: List[str] = [str(binary_path), "tool", "upgrade", tool_name]
else:
# We don't want to quietly uninstall dependencies by just specifying # We don't want to quietly uninstall dependencies by just specifying
# `--extra gdb` so we will be conservative and pull all extras in. # `--extra gdb` so we will be conservative and pull all extras in.
command: List[str] = [str(binary_path), "sync", "--all-extras"] command: List[str] = [str(binary_path), "sync", "--all-extras"]
@ -77,7 +84,7 @@ def update_deps(src_root: Path) -> None:
return return
dev_mode = is_dev_mode(venv_path) dev_mode = is_dev_mode(venv_path)
stdout, stderr, return_code = run_uv_install(uv_path, src_root, dev=dev_mode) stdout, stderr, return_code = run_uv_install(uv_path, src_root, venv_path, dev=dev_mode)
if return_code == 0: if return_code == 0:
uv_lock_hash_path.write_text(current_hash) uv_lock_hash_path.write_text(current_hash)

Loading…
Cancel
Save