various improvements and fixes
This commit is contained in:
+14
-8
@@ -11,20 +11,26 @@ echo "Checking for new pipx applications..."
|
||||
install_pipx_apps "${PIPX[@]}" || STATUS=1
|
||||
|
||||
# pipx venvs are tied to the Python they were built with, so a Python upgrade
|
||||
# breaks them in a way `pipx upgrade-all` can't repair. Rebuild them when the
|
||||
# Python version changes, or when an upgrade fails.
|
||||
# breaks them in a way `pipx upgrade` can't repair. Rebuild them all when the
|
||||
# Python version changes; otherwise upgrade the apps CoreDesktop installs (gext
|
||||
# comes from ensure_gext), rebuilding one if its upgrade fails. Apps you
|
||||
# installed yourself are left to you, so one of them can't fail the update.
|
||||
STAMP="$HOME/.local/state/coredesktop/pipx-python-version"
|
||||
CURRENT_PYTHON="$(python3 -c 'import sys; print("%d.%d" % sys.version_info[:2])')"
|
||||
|
||||
if [ "$(cat "$STAMP" 2>/dev/null)" != "$CURRENT_PYTHON" ]; then
|
||||
echo "Python changed to $CURRENT_PYTHON, reinstalling pipx applications..."
|
||||
pipx reinstall-all
|
||||
pipx reinstall-all && mkdir -p "$(dirname "$STAMP")" && echo "$CURRENT_PYTHON" > "$STAMP" || STATUS=1
|
||||
else
|
||||
echo "Updating pipx applications..."
|
||||
if ! pipx upgrade-all; then
|
||||
echo "pipx upgrade-all failed, reinstalling pipx applications..."
|
||||
pipx reinstall-all
|
||||
fi
|
||||
fi && mkdir -p "$(dirname "$STAMP")" && echo "$CURRENT_PYTHON" > "$STAMP" || STATUS=1
|
||||
installed="$(pipx list --short 2> /dev/null | cut -d' ' -f1)"
|
||||
for app in "${PIPX[@]}" gnome-extensions-cli; do
|
||||
grep -qx "$app" <<< "$installed" || continue
|
||||
if ! pipx upgrade "$app"; then
|
||||
echo "Upgrading $app failed, reinstalling it..."
|
||||
pipx reinstall "$app" || STATUS=1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exit $STATUS
|
||||
|
||||
Reference in New Issue
Block a user