Skip to content

Instantly share code, notes, and snippets.

@ximion
Last active August 30, 2016 00:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ximion/d1272a716c9eeb1ab744 to your computer and use it in GitHub Desktop.
Save ximion/d1272a716c9eeb1ab744 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import gi
gi.require_version('AppStream', '1.0')
from gi.repository import AppStream
# Find all software components which have a modalias in the
# AppStream database and prints them to stdout.
#
# WARNING: This is pure example code, which does no error
# checking at all!
pool = AppStream.Pool()
pool.load()
cpts = pool.get_components()
ma_cpts = list()
for cpt in cpts:
provided = cpt.get_provided_for_kind(AppStream.ProvidedKind.MODALIAS)
if provided:
ma_cpts.append(cpt)
# we got all components providing modaliases
for cpt in ma_cpts:
print(cpt.to_string())
print(" Modaliases:")
prov = cpt.get_provided_for_kind(AppStream.ProvidedKind.MODALIAS)
for item in prov.get_items():
print(" "+str(item))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment