sudo apt install python3-venv
mkdir ~/py-apt && cd $_
python3 -m venv --system-site-packages .venv
source .venv/bin/activate
# update pip and wheel
python3 -m pip install --upgrade pip wheel
# https://salsa.debian.org/python-debian-team/python-debian
python3 -m pip install --upgrade python-debian
# create the read_package.py script
python3 read_package.py
Last active
October 25, 2025 13:31
-
-
Save kyle0r/d180365a1f02b73054cb000cc7802e8b to your computer and use it in GitHub Desktop.
capturing steps + python script to read apt Packages files
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
| import apt | |
| from debian import deb822 | |
| from os.path import expanduser | |
| for pkg in deb822.Packages.iter_paragraphs(open(expanduser('~/Downloads/Packages'))): | |
| if 'amd64' == pkg['Architecture']: | |
| print(pkg['Package'], pkg['Filename'], pkg['version']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment