3c6e384a1d
* initial cleanup with some debug messaging * further cleanup, mostly coding style * - more cleanup, and speed-up - more fixes, including many icon and encoding related issues - replace some icons and remove compile.py - prepare for python3 port as much as possible * remove some more unneeded files, few left-over cleanups * move some external scripts to python3 already * Fix and clean up add_search_suggestions and add_apt_filter_results logic * more cleanup, thx Codacity * fix issue with a path * add a killall to the test script, fix a method declaration * fix custom colour setting * keybinding: re-add GdkX11 * re-add mint-common dep * Use os.path.expanduser("~") instead of os.environ * revert re-add GdkX11, but import Gtk first
28 lines
916 B
Python
Executable File
28 lines
916 B
Python
Executable File
#!/usr/bin/python3
|
|
|
|
import sys
|
|
|
|
import apt_pkg
|
|
|
|
if len(sys.argv) != 2:
|
|
sys.exit(1)
|
|
try:
|
|
apt_pkg.init()
|
|
cache = apt_pkg.Cache()
|
|
package_records = apt_pkg.PackageRecords(cache)
|
|
known_packages = set()
|
|
with open(sys.argv[1], "w") as f:
|
|
for pkg in cache.packages:
|
|
if pkg.selected_state or not pkg.version_list or pkg.name in known_packages:
|
|
continue
|
|
name = pkg.name
|
|
package_records.lookup(pkg.version_list.pop(0).translated_description.file_list.pop(0))
|
|
summary = package_records.short_desc
|
|
description = package_records.long_desc.replace(summary + "\n ", "").replace("\n .\n ", "~~~").replace("\n", "")
|
|
f.write("CACHE###%s###%s###%s\n" % (name, summary, description))
|
|
known_packages.add(name)
|
|
except Exception as e:
|
|
print("ERROR###ERROR###ERROR###ERROR")
|
|
print(e)
|
|
sys.exit(1)
|