Skip to content

Commit

Permalink
Uninstall previous plextraktsync pr if already installed
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Oct 17, 2022
1 parent 3bee159 commit a666996
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions plextraktsync/commands/self_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,24 @@ def enable_self_update():
return package is not None


def has_previous_pr(pr: int):
try:
from plextraktsync.util.execx import execx
execx(f"plextraktsync@{pr} --help")
except FileNotFoundError:
return False

return True


def self_update(pr: int):
if pr:
if has_previous_pr(pr):
# Uninstall because pipx doesn't update otherwise:
# - https://github.com/pypa/pipx/issues/902
click.echo(f"Uninstalling previous plextraktsync@{pr}")
system(f"pipx uninstall plextraktsync@{pr}")

click.echo(f"Updating PlexTraktSync to the pull request #{pr} version using pipx")
system(f"pipx install --suffix=@{pr} --force git+https://github.com/Taxel/PlexTraktSync@refs/pull/{pr}/head")
return
Expand Down

0 comments on commit a666996

Please sign in to comment.