Functions

agreement_kind_from_string (value)

agreement_kind_to_string (value)

artifact_kind_from_string (kind)

artifact_kind_to_string (kind)

bundle_kind_from_string (bundle_str)

bundle_kind_to_string (kind)

chassis_kind_from_string (kind_str)

chassis_kind_to_string (kind)

checksum_kind_from_string (kind_str)

checksum_kind_to_string (kind)

color_kind_from_string (str)

color_kind_to_string (kind)

color_scheme_kind_from_string (str)

color_scheme_kind_to_string (kind)

component_kind_from_string (kind_str)

component_kind_to_string (kind)

component_scope_from_string (scope_str)

component_scope_to_string (scope)

content_rating_system_format_age (system, age)

content_rating_system_from_locale (locale)

content_rating_system_get_csm_ages (system)

content_rating_system_get_formatted_ages (system)

content_rating_system_to_string (system)

content_rating_value_from_string (value)

content_rating_value_to_string (value)

control_kind_from_string (kind_str)

control_kind_to_string (kind)

display_side_kind_from_string (kind_str)

display_side_kind_to_string (kind)

format_kind_from_string (kind_str)

format_kind_to_string (kind)

format_version_from_string (version_str)

format_version_to_string (version)

get_current_distro_component_id ()

get_default_categories (with_special)

get_license_name (license)

get_license_url (license)

gstring_replace (string, find, replace, limit)

icon_kind_from_string (kind_str)

icon_kind_to_string (kind)

image_kind_from_string (kind)

image_kind_to_string (kind)

internet_kind_from_string (kind_str)

internet_kind_to_string (kind)

is_spdx_license_exception_id (exception_id)

is_spdx_license_expression (license)

is_spdx_license_id (license_id)

issue_kind_from_string (kind_str)

issue_kind_to_string (kind)

issue_severity_from_string (str)

issue_severity_to_string (severity)

launchable_kind_from_string (kind_str)

launchable_kind_to_string (kind)

license_is_free_license (license)

license_is_metadata_license (license)

license_is_metadata_license_id (license_id)

license_to_spdx_id (license)

markup_convert (markup, to_kind)

markup_strsplit_words (text, line_len)

merge_kind_from_string (kind_str)

merge_kind_to_string (kind)

metadata_error_quark ()

pool_error_quark ()

provided_kind_from_string (kind_str)

provided_kind_to_l10n_string (kind)

provided_kind_to_string (kind)

reference_kind_from_string (str)

reference_kind_to_string (kind)

relation_compare_from_string (compare_str)

relation_compare_to_string (compare)

relation_compare_to_symbols_string (compare)

relation_error_quark ()

relation_item_kind_from_string (kind_str)

relation_item_kind_to_string (kind)

relation_kind_from_string (kind_str)

relation_kind_to_string (kind)

release_kind_from_string (kind_str)

release_kind_to_string (kind)

release_list_kind_from_string (kind_str)

release_list_kind_to_string (kind)

release_url_kind_from_string (kind_str)

release_url_kind_to_string (kind)

screenshot_kind_from_string (kind)

screenshot_kind_to_string (kind)

size_kind_from_string (size_kind)

size_kind_to_string (size_kind)

spdx_license_detokenize (license_tokens)

spdx_license_tokenize (license)

suggested_kind_from_string (kind_str)

suggested_kind_to_string (kind)

system_info_error_quark ()

translation_kind_from_string (kind_str)

translation_kind_to_string (kind)

urgency_kind_from_string (urgency_kind)

urgency_kind_to_string (urgency_kind)

url_kind_from_string (url_kind)

url_kind_to_string (url_kind)

utils_build_data_id (scope, bundle_kind, origin, cid, branch)

utils_data_id_equal (data_id1, data_id2)

utils_data_id_get_cid (data_id)

utils_data_id_hash (data_id)

utils_data_id_match (data_id1, data_id2, match_flags)

utils_data_id_valid (data_id)

utils_error_quark ()

utils_get_desktop_environment_name (de_id)

utils_get_gui_environment_style_name (env_style)

utils_get_tag_search_weight (tag_name)

utils_guess_scope_from_path (path)

utils_install_metadata_file (location, filename, origin, destdir)

utils_is_category_name (category_name)

utils_is_desktop_environment (de_id)

utils_is_gui_environment_style (env_style)

utils_is_platform_triplet (triplet)

utils_is_tld (tld)

utils_locale_is_compatible (locale1, locale2)

utils_posix_locale_to_bcp47 (locale)

utils_sort_components_into_categories (cpts, categories, check_duplicates)

validator_error_quark ()

vercmp (a, b, flags)

vercmp_simple (a, b)

vercmp_test_match (ver1, compare, ver2, flags)

version_string ()

video_codec_kind_from_string (str)

video_codec_kind_to_string (kind)

video_container_kind_from_string (str)

video_container_kind_to_string (kind)

Details

AppStream.agreement_kind_from_string(value)
Parameters:

value (str) – the string.

Returns:

a AppStream.AgreementKind or AppStream.AgreementKind.UNKNOWN for unknown

Return type:

AppStream.AgreementKind

Converts the text representation to an enumerated value.

New in version 0.12.1.

AppStream.agreement_kind_to_string(value)
Parameters:

value (AppStream.AgreementKind) – the AppStream.AgreementKind.

Returns:

string version of value

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.12.1.

AppStream.artifact_kind_from_string(kind)
Parameters:

kind (str) – the string.

Returns:

a AppStream.ArtifactKind, or AppStream.ArtifactKind.UNKNOWN for unknown.

Return type:

AppStream.ArtifactKind

Converts the text representation to an enumerated value.

AppStream.artifact_kind_to_string(kind)
Parameters:

kind (AppStream.ArtifactKind) – the AppStream.ArtifactKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.bundle_kind_from_string(bundle_str)
Parameters:

bundle_str (str) – the string.

Returns:

a AppStream.BundleKind or AppStream.BundleKind.UNKNOWN for unknown

Return type:

AppStream.BundleKind

Converts the text representation to an enumerated value.

AppStream.bundle_kind_to_string(kind)
Parameters:

kind (AppStream.BundleKind) – the AppStream.BundleKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.8.0.

AppStream.chassis_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.ChassisKind or AppStream.ChassisKind.UNKNOWN for unknown

Return type:

AppStream.ChassisKind

Converts the text representation to an enumerated value.

New in version 1.0.0.

AppStream.chassis_kind_to_string(kind)
Parameters:

kind (AppStream.ChassisKind) – the AppStream.ChassisKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

New in version 1.0.0.

AppStream.checksum_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.ChecksumKind or AppStream.ChecksumKind.NONE for unknown

Return type:

AppStream.ChecksumKind

Converts the text representation to an enumerated value.

AppStream.checksum_kind_to_string(kind)
Parameters:

kind (AppStream.ChecksumKind) – the AppStream.ChecksumKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.color_kind_from_string(str)
Parameters:

str (str) – the string.

Returns:

a AppStream.ColorKind or AppStream.ColorKind.UNKNOWN for unknown.

Return type:

AppStream.ColorKind

Converts the text representation to an enumerated value.

New in version 0.15.2.

AppStream.color_kind_to_string(kind)
Parameters:

kind (AppStream.ColorKind) – the AppStream.ColorKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.15.2.

AppStream.color_scheme_kind_from_string(str)
Parameters:

str (str) – the string.

Returns:

a AppStream.ColorKind or AppStream.ColorSchemeKind.UNKNOWN for unknown.

Return type:

AppStream.ColorSchemeKind

Converts the text representation to an enumerated value.

New in version 0.15.2.

AppStream.color_scheme_kind_to_string(kind)
Parameters:

kind (AppStream.ColorSchemeKind) – the AppStream.ColorSchemeKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.15.2.

AppStream.component_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.ComponentKind or AppStream.ComponentKind.UNKNOWN for unknown

Return type:

AppStream.ComponentKind

Converts the text representation to an enumerated value.

AppStream.component_kind_to_string(kind)
Parameters:

kind (AppStream.ComponentKind) – the AppStream.ComponentKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.component_scope_from_string(scope_str)
Parameters:

scope_str (str) – the string.

Returns:

a AppStream.ComponentScope or AppStream.ComponentScope.UNKNOWN for unknown

Return type:

AppStream.ComponentScope

Converts the text representation to an enumerated value.

AppStream.component_scope_to_string(scope)
Parameters:

scope (AppStream.ComponentScope) – the AppStream.ComponentScope.

Returns:

string version of scope

Return type:

str

Converts the enumerated value to an text representation.

AppStream.content_rating_system_format_age(system, age)
Parameters:
Returns:

a newly allocated formatted version of age, or None if the given system has no representation for age

Return type:

str or None

Format age as a human-readable string in the given rating system. This is the way to present system-specific strings in a UI.

New in version 0.12.12.

AppStream.content_rating_system_from_locale(locale)
Parameters:

locale (str) – a locale, in the format described in man 3 setlocale

Returns:

the most relevant AppStream.ContentRatingSystem

Return type:

AppStream.ContentRatingSystem

Determine the most appropriate AppStream.ContentRatingSystem for the given locale. Content rating systems are selected by territory. If no content rating system seems suitable, AppStream.ContentRatingSystem.IARC is returned.

New in version 0.12.12.

AppStream.content_rating_system_get_csm_ages(system)
Parameters:

system (AppStream.ContentRatingSystem) – an AppStream.ContentRatingSystem

Returns:

an array of CSM ages

Return type:

[int]

Get the CSM ages corresponding to the entries returned by AppStream.ContentRatingSystem.get_formatted_ages() for this system.

New in version 0.12.12.

AppStream.content_rating_system_get_formatted_ages(system)
Parameters:

system (AppStream.ContentRatingSystem) – an AppStream.ContentRatingSystem

Returns:

None-terminated array of human-readable age strings

Return type:

[str]

Get an array of all the possible return values of AppStream.ContentRatingSystem.format_age() for the given system. The array is sorted with youngest CSM age first.

New in version 0.12.12.

AppStream.content_rating_system_to_string(system)
Parameters:

system (AppStream.ContentRatingSystem) – an AppStream.ContentRatingSystem

Returns:

a human-readable string for system, or None if unknown

Return type:

str or None

Get a human-readable string to identify system. None will be returned for AppStream.ContentRatingSystem.UNKNOWN.

New in version 0.12.12.

AppStream.content_rating_value_from_string(value)
Parameters:

value (str) – the string.

Returns:

a AppStream.ContentRatingValue or AppStream.ContentRatingValue.UNKNOWN for unknown

Return type:

AppStream.ContentRatingValue

Converts the text representation to an enumerated value.

New in version 0.11.0.

AppStream.content_rating_value_to_string(value)
Parameters:

value (AppStream.ContentRatingValue) – the AppStream.ContentRatingValue.

Returns:

string version of value

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.11.0.

AppStream.control_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.ControlKind or AppStream.ControlKind.UNKNOWN for unknown

Return type:

AppStream.ControlKind

Converts the text representation to an enumerated value.

New in version 0.12.11.

AppStream.control_kind_to_string(kind)
Parameters:

kind (AppStream.ControlKind) – the AppStream.ControlKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

New in version 0.12.11.

AppStream.display_side_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.DisplaySideKind or AppStream.DisplaySideKind.UNKNOWN for unknown

Return type:

AppStream.DisplaySideKind

Converts the text representation to an enumerated value.

New in version 0.12.12.

AppStream.display_side_kind_to_string(kind)
Parameters:

kind (AppStream.DisplaySideKind) – the AppStream.DisplaySideKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

New in version 0.12.12.

AppStream.format_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.FormatKind or AppStream.FormatKind.UNKNOWN for unknown

Return type:

AppStream.FormatKind

Converts the text representation to an enumerated value.

New in version 0.10.0.

AppStream.format_kind_to_string(kind)
Parameters:

kind (AppStream.FormatKind) – the AppStream.FormatKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.10.0.

AppStream.format_version_from_string(version_str)
Parameters:

version_str (str) – the string.

Returns:

a AppStream.FormatVersion. For unknown, the highest version number is assumed.

Return type:

AppStream.FormatVersion

Converts the text representation to an enumerated value.

New in version 0.10.0.

AppStream.format_version_to_string(version)
Parameters:

version (AppStream.FormatVersion) – the AppStream.FormatKind.

Returns:

string version of version

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.10.0.

AppStream.get_current_distro_component_id()
Return type:

str

Returns the component-ID of the current distribution based on contents of the /etc/os-release file. This function is a shorthand for %as_distro_details_get_cid

AppStream.get_default_categories(with_special)
Parameters:

with_special (bool) – Include special categories (e.g. “addons”, and “all”/”featured” in submenus)

Returns:

a list of AppStream.Category

Return type:

[AppStream.Category]

Get a list of the default Freedesktop and AppStream categories that software components (especially GUI applications) can be sorted into in software centers.

This function fully transfers ownership of the returned container, to be used in GIR bindings.

AppStream.get_license_name(license)
Parameters:

license (str) – The SPDX license ID.

Returns:

The license name, or None if none found.

Return type:

str or None

Get a translated license name for the given SPDX ID.

New in version 1.0.0.

AppStream.get_license_url(license)
Parameters:

license (str) – The SPDX license ID.

Returns:

The license URL, or None if none available.

Return type:

str or None

Get a web URL to the license text and more license information for an SPDX license identifier.

New in version 0.12.7.

AppStream.gstring_replace(string, find, replace, limit)
Parameters:
  • string (GLib.String) – a GLib.String

  • find (str) – the string to find in string

  • replace (str) – the string to insert in place of find

  • limit (int) – the maximum instances of find to replace with replace, or 0 for no limit

Returns:

the number of find and replace operations performed.

Return type:

int

Replaces the string find with the string replace in a GLib.String up to limit times. If the number of instances of find in the GLib.String is less than limit, all instances are replaced. If limit is 0, all instances of find are replaced.

AppStream.icon_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.IconKind or AppStream.IconKind.UNKNOWN for unknown

Return type:

AppStream.IconKind

Converts the text representation to an enumerated value.

AppStream.icon_kind_to_string(kind)
Parameters:

kind (AppStream.IconKind) – the AppStream.IconKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.image_kind_from_string(kind)
Parameters:

kind (str) – the string.

Returns:

a AppStream.ImageKind, or AppStream.ImageKind.UNKNOWN for unknown.

Return type:

AppStream.ImageKind

Converts the text representation to an enumerated value.

AppStream.image_kind_to_string(kind)
Parameters:

kind (AppStream.ImageKind) – the AppStream.ImageKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.internet_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.InternetKind or AppStream.InternetKind.UNKNOWN for unknown

Return type:

AppStream.InternetKind

Converts the text representation to an enumerated value.

New in version 0.15.5.

AppStream.internet_kind_to_string(kind)
Parameters:

kind (AppStream.InternetKind) – the AppStream.InternetKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

New in version 0.15.5.

AppStream.is_spdx_license_exception_id(exception_id)
Parameters:

exception_id (str) – a single SPDX license exception ID, e.g. “GCC-exception-3.1”

Returns:

True if the string is a valid SPDX license exception ID

Return type:

bool

Searches the known list of SPDX license exception IDs.

New in version 0.12.10.

AppStream.is_spdx_license_expression(license)
Parameters:

license (str) – a SPDX license string, e.g. “CC-BY-3.0 and GFDL-1.3”

Returns:

True if the icon is a valid “SPDX license”

Return type:

bool

Checks the licence string to check it being a valid licence. NOTE: SPDX licenses can’t typically contain brackets.

New in version 0.9.8.

AppStream.is_spdx_license_id(license_id)
Parameters:

license_id (str) – a single SPDX license ID, e.g. “GPL-3.0”

Returns:

True if the string is a valid SPDX license ID

Return type:

bool

Searches the known list of SPDX license IDs.

New in version 0.9.8.

AppStream.issue_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.IssueKind or AppStream.IssueKind.UNKNOWN for unknown

Return type:

AppStream.IssueKind

Converts the text representation to an enumerated value.

AppStream.issue_kind_to_string(kind)
Parameters:

kind (AppStream.IssueKind) – the AppStream.IssueKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.issue_severity_from_string(str)
Parameters:

str (str) – the string.

Returns:

a AppStream.IssueSeverity, or AppStream.IssueSeverity.UNKNOWN for unknown.

Return type:

AppStream.IssueSeverity

Converts the text representation to an enumerated value.

AppStream.issue_severity_to_string(severity)
Parameters:

severity (AppStream.IssueSeverity) – the AppStream.IssueSeverity.

Returns:

string version of severity

Return type:

str

Converts the enumerated value to an text representation.

AppStream.launchable_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.LaunchableKind or AppStream.LaunchableKind.UNKNOWN for unknown

Return type:

AppStream.LaunchableKind

Converts the text representation to an enumerated value.

New in version 0.11.0.

AppStream.launchable_kind_to_string(kind)
Parameters:

kind (AppStream.LaunchableKind) – the AppStream.LaunchableKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

New in version 0.11.0.

AppStream.license_is_free_license(license)
Parameters:

license (str) – The SPDX license string to test.

Returns:

True if the license string contains only free-as-in-freedom licenses.

Return type:

bool

Check if the given license is for free-as-in-freedom software. A free software license is either approved by the Free Software Foundation or the Open Source Initiative.

This function does *not* yet handle complex license expressions with AND and OR. If the expression contains any of these, it will still simply check if all mentioned licenses are Free licenses. Currently, any license exception recognized by SPDX is assumed to not impact the free-ness status of a software component.

Please note that this function does not give any legal advice. Please read the license texts to learn more about the individual licenses and their conditions.

New in version 0.12.10.

AppStream.license_is_metadata_license(license)
Parameters:

license (str) – The SPDX license string to test.

Returns:

True if the license contains only permissive licenses suitable as metadata license.

Return type:

bool

Check if the metadata license is suitable for mixing with other metadata and redistributing the bundled result (this means we prefer permissive licenses here, to not require people shipping catalog metadata to perform a full license review).

This method checks against a hardcoded list of permissive licenses commonly used to license metadata under.

AppStream.license_is_metadata_license_id(license_id)
Parameters:

license_id (str) – a single SPDX license ID, e.g. “FSFAP”

Returns:

True if the string is a valid metadata license ID.

Return type:

bool

Tests license ID against the vetted list of licenses that can be used for metainfo metadata. This function will not work for license expressions, if you need to test an SPDX license expression for compliance, please use AppStream.license_is_metadata_license insread.

AppStream.license_to_spdx_id(license)
Parameters:

license (str) – a not-quite SPDX license string, e.g. “GPLv3+”

Returns:

the best-effort SPDX license string

Return type:

str

Converts a non-SPDX license into an SPDX format string where possible.

New in version 0.9.8.

AppStream.markup_convert(markup, to_kind)
Parameters:
  • markup (str) – the XML markup to transform.

  • to_kind (AppStream.MarkupKind) – The markup style to convert into.

Raises:

GLib.Error

Returns:

a newly allocated string, or None on error.

Return type:

str

Converts XML description markup into other forms of text.

AppStream.markup_strsplit_words(text, line_len)
Parameters:
  • text (str) – the text to split.

  • line_len (int) – the maximum length of the output line

Returns:

lines, or None in event of an error

Return type:

[str]

Splits up a long line into an array of smaller strings, each being no longer than line_len. Words are not split.

New in version 0.14.0.

AppStream.merge_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.MergeKind or AppStream.MergeKind.NONE for unknown

Return type:

AppStream.MergeKind

Converts the text representation to an enumerated value.

AppStream.merge_kind_to_string(kind)
Parameters:

kind (AppStream.MergeKind) – the AppStream.MergeKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.metadata_error_quark()
Returns:

An error quark.

Return type:

int

AppStream.pool_error_quark()
Returns:

An error quark.

Return type:

int

AppStream.provided_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.ProvidedKind or AppStream.ProvidedKind.UNKNOWN for unknown

Return type:

AppStream.ProvidedKind

Converts the text representation to an enumerated value.

AppStream.provided_kind_to_l10n_string(kind)
Parameters:

kind (AppStream.ProvidedKind) – the AppStream.ProvidedKind.

Returns:

Pluralized, l10n string version of kind

Return type:

str

Converts the enumerated value to a localized text representation, using the plural forms (e.g. “Libraries” instead of “Library”).

This can be useful when displaying provided items in GUI dialogs.

AppStream.provided_kind_to_string(kind)
Parameters:

kind (AppStream.ProvidedKind) – the AppStream.ProvidedKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

AppStream.reference_kind_from_string(str)
Parameters:

str (str) – the string.

Returns:

a AppStream.ReferenceKind or AppStream.ReferenceKind.UNKNOWN for unknown

Return type:

AppStream.ReferenceKind

Converts the text representation to an enumerated value.

AppStream.reference_kind_to_string(kind)
Parameters:

kind (AppStream.ReferenceKind) – the AppStream.ReferenceKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 1.0.0.

AppStream.relation_compare_from_string(compare_str)
Parameters:

compare_str (str) – the string.

Returns:

a AppStream.RelationCompare, or AppStream.RelationCompare.UNKNOWN for unknown.

Return type:

AppStream.RelationCompare

Converts the text representation to an enumerated value.

New in version 0.12.0.

AppStream.relation_compare_to_string(compare)
Parameters:

compare (AppStream.RelationCompare) – the AppStream.RelationCompare.

Returns:

string version of compare

Return type:

str

Converts the enumerated value to an text representation. The enum is converted into a two-letter identifier (“eq”, “ge”, etc.) for use in the XML representation.

New in version 0.12.0.

AppStream.relation_compare_to_symbols_string(compare)
Parameters:

compare (AppStream.RelationCompare) – the AppStream.RelationCompare.

Returns:

string version of compare

Return type:

str

Converts the enumerated value to an text representation. The enum is converted into an identifier consisting of two mathematical comparison operators (“==”, “>=”, etc.) for use in the YAML representation and user interfaces.

New in version 0.12.0.

AppStream.relation_error_quark()
Returns:

An error quark.

Return type:

int

New in version 0.16.0.

AppStream.relation_item_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.RelationItemKind or AppStream.RelationItemKind.UNKNOWN for unknown

Return type:

AppStream.RelationItemKind

Converts the text representation to an enumerated value.

New in version 0.12.0.

AppStream.relation_item_kind_to_string(kind)
Parameters:

kind (AppStream.RelationItemKind) – the AppStream.RelationKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

New in version 0.12.0.

AppStream.relation_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.RelationKind or AppStream.RelationKind.UNKNOWN for unknown

Return type:

AppStream.RelationKind

Converts the text representation to an enumerated value.

New in version 0.12.0.

AppStream.relation_kind_to_string(kind)
Parameters:

kind (AppStream.RelationKind) – the AppStream.RelationKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

New in version 0.12.0.

AppStream.release_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

an AppStream.ReleaseKind or AppStream.ReleaseKind.UNKNOWN for unknown

Return type:

AppStream.ReleaseKind

Converts the text representation to an enumerated value.

New in version 0.12.0.

AppStream.release_kind_to_string(kind)
Parameters:

kind (AppStream.ReleaseKind) – the AppStream.ReleaseKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.12.0.

AppStream.release_list_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

an AppStream.ReleaseKind or AppStream.ReleaseKind.UNKNOWN for unknown

Return type:

AppStream.ReleaseListKind

Converts the text representation to an enumerated value.

New in version 0.16.0.

AppStream.release_list_kind_to_string(kind)
Parameters:

kind (AppStream.ReleaseListKind) – the AppStream.ReleaseKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.16.0.

AppStream.release_url_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

an AppStream.ReleaseUrlKind or AppStream.ReleaseUrlKind.UNKNOWN for unknown

Return type:

AppStream.ReleaseUrlKind

Converts the text representation to an enumerated value.

New in version 0.12.5.

AppStream.release_url_kind_to_string(kind)
Parameters:

kind (AppStream.ReleaseUrlKind) – the AppStream.ReleaseUrlKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.12.5.

AppStream.screenshot_kind_from_string(kind)
Parameters:

kind (str) – the string.

Returns:

a AppStream.ScreenshotKind, or AppStream.ScreenshotKind.UNKNOWN if not known.

Return type:

AppStream.ScreenshotKind

Converts the text representation to an enumerated value.

AppStream.screenshot_kind_to_string(kind)
Parameters:

kind (AppStream.ScreenshotKind) – the AppStream.ScreenshotKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.size_kind_from_string(size_kind)
Parameters:

size_kind (str) – the string.

Returns:

an AppStream.SizeKind or AppStream.SizeKind.UNKNOWN for unknown

Return type:

AppStream.SizeKind

Converts the text representation to an enumerated value.

AppStream.size_kind_to_string(size_kind)
Parameters:

size_kind (AppStream.SizeKind) – the AppStream.SizeKind.

Returns:

string version of size_kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.spdx_license_detokenize(license_tokens)
Parameters:

license_tokens (str) – license tokens, typically from AppStream.spdx_license_tokenize()

Returns:

string, or None for invalid

Return type:

str or None

De-tokenizes the SPDX licenses into a string.

New in version 0.9.8.

AppStream.spdx_license_tokenize(license)
Parameters:

license (str) – a license string, e.g. “LGPLv2+ and (QPL or GPLv2) and MIT”

Returns:

array of strings, or None for invalid

Return type:

[str] or None

Tokenizes the SPDX license string (or any simarly formatted string) into parts. Any license parts of the string e.g. “LGPL-2.0+” are prefexed with “@”, the conjunctive replaced with “&”, the disjunctive replaced with “|” and the WITH operator for license exceptions replaced with “^”. Brackets are added as indervidual tokens and other strings are appended into single tokens where possible.

New in version 0.9.8.

AppStream.suggested_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.SuggestedKind or AppStream.SuggestedKind.UNKNOWN for unknown

Return type:

AppStream.SuggestedKind

Converts the text representation to an enumerated value.

AppStream.suggested_kind_to_string(kind)
Parameters:

kind (AppStream.SuggestedKind) – the AppStream.SuggestedKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.system_info_error_quark()
Returns:

An error quark.

Return type:

int

New in version 0.16.0.

AppStream.translation_kind_from_string(kind_str)
Parameters:

kind_str (str) – the string.

Returns:

a AppStream.TranslationKind or AppStream.TranslationKind.UNKNOWN for unknown

Return type:

AppStream.TranslationKind

Converts the text representation to an enumerated value.

AppStream.translation_kind_to_string(kind)
Parameters:

kind (AppStream.TranslationKind) – the AppStream.TranslationKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to a text representation.

AppStream.urgency_kind_from_string(urgency_kind)
Parameters:

urgency_kind (str) – the string.

Returns:

a AppStream.UrgencyKind or AppStream.UrgencyKind.UNKNOWN for unknown

Return type:

AppStream.UrgencyKind

Converts the text representation to an enumerated value.

New in version 0.6.5.

AppStream.urgency_kind_to_string(urgency_kind)
Parameters:

urgency_kind (AppStream.UrgencyKind) – the AppStream.UrgencyKind.

Returns:

string version of urgency_kind

Return type:

str

Converts the enumerated value to an text representation.

New in version 0.6.5.

AppStream.url_kind_from_string(url_kind)
Parameters:

url_kind (str) – the string.

Returns:

a AppStream.UrlKind or AppStream.UrlKind.UNKNOWN for unknown

Return type:

AppStream.UrlKind

Converts the text representation to an enumerated value.

AppStream.url_kind_to_string(url_kind)
Parameters:

url_kind (AppStream.UrlKind) – the AppStream.UrlKind.

Returns:

string version of url_kind

Return type:

str

Converts the enumerated value to an text representation.

AppStream.utils_build_data_id(scope, bundle_kind, origin, cid, branch)
Parameters:
Return type:

str

Builds an identifier string unique to the individual dataset using the supplied information.

New in version 0.14.0.

AppStream.utils_data_id_equal(data_id1, data_id2)
Parameters:
  • data_id1 (str) – a data ID

  • data_id2 (str) – another data ID

Returns:

True if the ID’s should be considered equal.

Return type:

bool

Checks two component data IDs for equality allowing globs to match.

New in version 0.14.0.

AppStream.utils_data_id_get_cid(data_id)
Parameters:

data_id (str) – The data-id.

Return type:

str

Get the component-id part of the data-id.

AppStream.utils_data_id_hash(data_id)
Parameters:

data_id (str) – a data ID

Returns:

a hash value corresponding to the key

Return type:

int

Converts a data-id to a hash value.

This function implements the widely used DJB hash on the ID subset of the data-id string.

It can be passed to g_hash_table_new() as the hash_func parameter, when using non-None strings or unique_ids as keys in a GLib.HashTable.

New in version 0.14.0.

AppStream.utils_data_id_match(data_id1, data_id2, match_flags)
Parameters:
Returns:

True if the IDs should be considered equal.

Return type:

bool

Checks two data IDs for equality allowing globs to match, whilst also allowing clients to whitelist sections that have to match.

New in version 0.14.0.

AppStream.utils_data_id_valid(data_id)
Parameters:

data_id (str) – a component data ID

Returns:

True if the ID is valid

Return type:

bool

Checks if a data ID is valid i.e. has the correct number of sections.

New in version 0.14.0.

AppStream.utils_error_quark()
Returns:

An error quark.

Return type:

int

New in version 0.14.0.

AppStream.utils_get_desktop_environment_name(de_id)
Parameters:

de_id (str) – a desktop environment id.

Returns:

A localized name of the DE, or None if none available.

Return type:

str

Get a human-readable, translated name of the desktop environment represented by the given ID.

New in version 1.0.0.

AppStream.utils_get_gui_environment_style_name(env_style)
Parameters:

env_style (str) – a GUI environment style ID, e.g. “pantheon:dark”

Returns:

A localized name of the environment style, or None if none available.

Return type:

str

Get a human-readable, translated name of the combination of GUI environment and style. E.g. “plasma:dark” becomes “Plasma (Dark)”.

New in version 1.0.0.

AppStream.utils_get_tag_search_weight(tag_name)
Parameters:

tag_name (str) – A tag name in a component element, e.g. “name” or “summary” or “keyword”

Returns:

The tag weight used in (fulltext) searches. 0 for lowest weight/unused.

Return type:

int

Retrieve the raw search token weight for the given tag name that AppStream uses internally for searching. This can be used to implement separate, but compatible search logic.

AppStream.utils_guess_scope_from_path(path)
Parameters:

path (str) – The filename to test.

Returns:

the AppStream.ComponentScope

Return type:

AppStream.ComponentScope

Guess the AppStream.ComponentScope that applies to a given path.

New in version 0.15.0.

AppStream.utils_install_metadata_file(location, filename, origin, destdir)
Parameters:
Raises:

GLib.Error

Returns:

True for success, False if error is set

Return type:

bool

Installs an AppStream MetaInfo, AppStream Metadata Catalog or AppStream Icon tarball file to the right place on the filesystem. Please note that this function does almost no validation and may guess missing values such as icon sizes and origin names. Ensure your metadata is good before installing it.

New in version 0.14.0.

AppStream.utils_is_category_name(category_name)
Parameters:

category_name (str) – a XDG category name, e.g. “ProjectManagement”

Returns:

True if the category name is valid

Return type:

bool

Searches the known list of registered XDG category names. See https://specifications.freedesktop.org/menu-spec/menu-spec-1.0.html#category-registry for a reference.

New in version 0.9.7.

AppStream.utils_is_desktop_environment(de_id)
Parameters:

de_id (str) – a desktop environment id.

Returns:

True if the desktop-id is valid

Return type:

bool

Checks if the submitted desktop environment ID is known and valid.

New in version 0.10.0.

AppStream.utils_is_gui_environment_style(env_style)
Parameters:

env_style (str) – a GUI environment style ID, e.g. “pantheon:dark”

Returns:

True if the environment-style ID is is valid

Return type:

bool

Checks if the given identifier is a valid, known GUI environment style.

New in version 1.0.0.

AppStream.utils_is_platform_triplet(triplet)
Parameters:

triplet (str) – a platform triplet.

Returns:

True if triplet is valid.

Return type:

bool

Test if the given string is a valid platform triplet recognized by AppStream.

New in version 0.14.0.

AppStream.utils_is_tld(tld)
Parameters:

tld (str) – a top-level domain without dot, e.g. “de”, “org”, “name”

Returns:

True if the TLD is valid

Return type:

bool

Searches the known list of TLDs we allow for AppStream IDs. This excludes internationalized names.

New in version 0.9.8.

AppStream.utils_locale_is_compatible(locale1, locale2)
Parameters:
  • locale1 (str or None) – a BCP47 or POSIX locale string, or None

  • locale2 (str or None) – a BCP47 or POSIX locale string, or None

Returns:

True if the locale is compatible.

Return type:

bool

Calculates if one locale is compatible with another. When doing the calculation the locale and language code is taken into account if possible.

New in version 0.9.5.

AppStream.utils_posix_locale_to_bcp47(locale)
Parameters:

locale (str) –

Returns:

A locale string, free with GLib.free()

Return type:

str

Converts a POSIX locale string to the corresponding IETF BCP47 format. If the given locale is already in BCP47 format, no change will be done.

AppStream.utils_sort_components_into_categories(cpts, categories, check_duplicates)
Parameters:

Sorts all components in cpts into the AppStream.Category categories listed in categories.

AppStream.validator_error_quark()
Returns:

An error quark.

Return type:

int

New in version 0.15.4.

AppStream.vercmp(a, b, flags)
Parameters:
Returns:

>>0 if a is newer than b; 0 if a and b are the same version; <<0 if b is newer than a

Return type:

int

Compare alpha and numeric segments of two software versions, considering flags.

AppStream.vercmp_simple(a, b)
Parameters:
  • a (str) – First version number

  • b (str) – Second version number

Returns:

>>0 if a is newer than b; 0 if a and b are the same version; <<0 if b is newer than a

Return type:

int

Compare alpha and numeric segments of two software versions.

AppStream.vercmp_test_match(ver1, compare, ver2, flags)
Parameters:
Returns:

True if the version comparison matches, False otherwise.

Return type:

bool

Compare two version numbers and check if the given version comparator matches.

New in version 0.16.0.

AppStream.version_string()
Returns:

a version number, e.g. “0.14.2”

Return type:

str

Get the version of the AppStream library that is currently used at runtime as a string.

New in version 0.14.0.

AppStream.video_codec_kind_from_string(str)
Parameters:

str (str) – the string.

Returns:

a AppStream.VideoCodecKind, or AppStream.VideoCodecKind.UNKNOWN for unknown.

Return type:

AppStream.VideoCodecKind

Converts the text representation to an enumerated value.

AppStream.video_codec_kind_to_string(kind)
Parameters:

kind (AppStream.VideoCodecKind) – the AppStream.VideoCodecKind.

Returns:

string version of codec

Return type:

str

Converts the enumerated value to an text representation.

AppStream.video_container_kind_from_string(str)
Parameters:

str (str) – the string.

Returns:

a AppStream.VideoContainerKind, or AppStream.VideoContainerKind.UNKNOWN for unknown.

Return type:

AppStream.VideoContainerKind

Converts the text representation to an enumerated value.

AppStream.video_container_kind_to_string(kind)
Parameters:

kind (AppStream.VideoContainerKind) – the AppStream.VideoContainerKind.

Returns:

string version of kind

Return type:

str

Converts the enumerated value to an text representation.