fix(scripts): replace deprecated pip --format=legacy in uninstall.sh#1344
Merged
ErikBjare merged 1 commit intoJul 5, 2026
Merged
Conversation
…ninstall.sh pip 23.0 (2023-01-30) removed the 'legacy' format. Switch to --format=freeze (package==version per line) and use cut -d'=' -f1 to extract just the package name. Fixes ActivityWatch#1343.
Contributor
Contributor
Author
Ready for Merge ✅
This is a 2-line fix for the deprecated |
Contributor
Author
|
Noting that @fanxing11 submitted a duplicate fix on #1349. Both are correct approaches, but this one is simpler ( Ready for maintainer review + merge whenever you get a chance, @ErikBjare. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
scripts/uninstall.shusespip3 list --format=legacy, but thelegacyformat was removed in pip 23.0 (released 2023-01-30). Running the script errors out with:As a result,
$modulesis always empty and nothing gets uninstalled.Fixes #1343.
Fix
Switch to
--format=freeze(outputspackage==versionper line, available since pip's earliest versions) and usecut -d'=' -f1to extract just the package name.Before:
modules=$(pip3 list --format=legacy | grep 'aw-' | grep -o '^aw-[^ ]*')After:
modules=$(pip3 list --format=freeze | grep '^aw-' | cut -d'=' -f1)Testing
Verified locally with pip 23.x —
pip3 list --format=freeze | grep '^aw-' | cut -d'=' -f1produces correct package names without version suffixes.