Skip to content

Instantly share code, notes, and snippets.

@maximtrp
Created December 11, 2020 17:34
Show Gist options
  • Save maximtrp/f81c5f31880d670e79b0b8b0817527a7 to your computer and use it in GitHub Desktop.
Save maximtrp/f81c5f31880d670e79b0b8b0817527a7 to your computer and use it in GitHub Desktop.
Filter updated packages installed using pip (and not pacman)
#!/usr/bin/bash
# updated packages
echo "[1] Getting updated packages list"
pip list -o | tail -n +3 | cut -d" " -f1 | tr - _ | sort > updated.txt
# pip-managed packages
echo "[2] Getting packages managed by pip"
find /usr/lib/python3.9/site-packages/ -name INSTALLER | grep --color -oE "site-packages/([^-\/]*?)" | sed "s/site-packages\///g" | sort > installed.txt
# intersect to create a list of updatable packages
echo "[3] Creating the list of updatable packages:"
grep -Fxf updated.txt installed.txt > update-list.txt
cat update-list.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment