Last active
August 30, 2016 00:46
-
-
Save ximion/d1272a716c9eeb1ab744 to your computer and use it in GitHub Desktop.
This file contains 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
#!/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