Skip to content

Commit

Permalink
fix(self-update): proper order of old and new + disable caching for s…
Browse files Browse the repository at this point in the history
…elf update
  • Loading branch information
robinvandernoord committed Apr 10, 2024
1 parent 2327f73 commit 27298eb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/uvx/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ def _self_update_via_cmd(pip_ish: BoundCommand, with_uv: bool):


def _self_update_via_uv(with_uv: bool):
return _self_update_via_cmd(_uv["pip"], with_uv=with_uv)
return _self_update_via_cmd(_uv["pip", "--no-cache"], with_uv=with_uv)


def _self_update_via_pip(with_uv: bool):
return _self_update_via_cmd(_pip, with_uv=with_uv)
return _self_update_via_cmd(_pip["--no-cache-dir"], with_uv=with_uv)


@app.command()
Expand All @@ -184,13 +184,13 @@ def self_update(
try:
if os.getenv("VIRTUAL_ENV"):
# already activated venv
new, old = _self_update_via_uv(with_uv=with_uv)
old, new = _self_update_via_uv(with_uv=with_uv)
elif sys.prefix != sys.base_prefix:
# venv-like environment (pipx, uvx)
with local.env(VIRTUAL_ENV=sys.prefix):
new, old = _self_update_via_uv(with_uv=with_uv)
old, new = _self_update_via_uv(with_uv=with_uv)
else:
new, old = _self_update_via_pip(with_uv=with_uv)
old, new = _self_update_via_pip(with_uv=with_uv)

except pb.ProcessExecutionError as e:
print(e.message, file=sys.stdout)
Expand Down

0 comments on commit 27298eb

Please sign in to comment.