Skip to content

Commit

Permalink
Merge pull request #1105 from glensc/pipx-pr-reinstall
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc authored Oct 17, 2022
2 parents 10be7a0 + a666996 commit cb6a79b
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 cb6a79b

Please sign in to comment.