Functions¶
Details¶
- AppStream.agreement_kind_from_string(value)¶
- Parameters:
value (
str
) – the string.- Returns:
a
AppStream.AgreementKind
orAppStream.AgreementKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 0.12.1.
- AppStream.agreement_kind_to_string(value)¶
- Parameters:
value (
AppStream.AgreementKind
) – theAppStream.AgreementKind
.- Returns:
string version of value
- Return type:
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
, orAppStream.ArtifactKind.UNKNOWN
for unknown.- Return type:
Converts the text representation to an enumerated value.
- AppStream.artifact_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ArtifactKind
) – theAppStream.ArtifactKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.BundleKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.bundle_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.BundleKind
) – theAppStream.BundleKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.ChassisKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 1.0.0.
- AppStream.chassis_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ChassisKind
) – theAppStream.ChassisKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.ChecksumKind.NONE
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.checksum_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ChecksumKind
) – theAppStream.ChecksumKind
.- Returns:
string version of kind
- Return type:
Converts the enumerated value to an text representation.
- AppStream.color_kind_from_string(str)¶
- Parameters:
str (
str
) – the string.- Returns:
a
AppStream.ColorKind
orAppStream.ColorKind.UNKNOWN
for unknown.- Return type:
Converts the text representation to an enumerated value.
New in version 0.15.2.
- AppStream.color_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ColorKind
) – theAppStream.ColorKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.ColorSchemeKind.UNKNOWN
for unknown.- Return type:
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
) – theAppStream.ColorSchemeKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.ComponentKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.component_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ComponentKind
) – theAppStream.ComponentKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.ComponentScope.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.component_scope_to_string(scope)¶
- Parameters:
scope (
AppStream.ComponentScope
) – theAppStream.ComponentScope
.- Returns:
string version of scope
- Return type:
Converts the enumerated value to an text representation.
- AppStream.content_rating_system_format_age(system, age)¶
- Parameters:
system (
AppStream.ContentRatingSystem
) – anAppStream.ContentRatingSystem
age (
int
) – a CSM age to format
- Returns:
a newly allocated formatted version of age, or
None
if the given system has no representation for age- Return type:
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 inman 3 setlocale
- Returns:
the most relevant
AppStream.ContentRatingSystem
- Return type:
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
) – anAppStream.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
) – anAppStream.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
) – anAppStream.ContentRatingSystem
- Returns:
a human-readable string for system, or
None
if unknown- Return type:
Get a human-readable string to identify system.
None
will be returned forAppStream.ContentRatingSystem.UNKNOWN
.New in version 0.12.12.
- AppStream.content_rating_value_from_string(value)¶
- Parameters:
value (
str
) – the string.- Returns:
a
AppStream.ContentRatingValue
orAppStream.ContentRatingValue.UNKNOWN
for unknown- Return type:
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
) – theAppStream.ContentRatingValue
.- Returns:
string version of value
- Return type:
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
orAppStream.ControlKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 0.12.11.
- AppStream.control_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ControlKind
) – theAppStream.ControlKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.DisplaySideKind.UNKNOWN
for unknown- Return type:
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
) – theAppStream.DisplaySideKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.FormatKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 0.10.0.
- AppStream.format_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.FormatKind
) – theAppStream.FormatKind
.- Returns:
string version of kind
- Return type:
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:
Converts the text representation to an enumerated value.
New in version 0.10.0.
- AppStream.format_version_to_string(version)¶
- Parameters:
version (
AppStream.FormatVersion
) – theAppStream.FormatKind
.- Returns:
string version of version
- Return type:
Converts the enumerated value to an text representation.
New in version 0.10.0.
- AppStream.get_current_distro_component_id()¶
- Return type:
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:
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:
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:
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
) – aGLib.String
find (
str
) – the string to find in stringreplace (
str
) – the string to insert in place of findlimit (
int
) – the maximum instances of find to replace with replace, or0
for no limit
- Returns:
the number of find and replace operations performed.
- Return type:
Replaces the string find with the string replace in a
GLib.String
up to limit times. If the number of instances of find in theGLib.String
is less than limit, all instances are replaced. If limit is0
, all instances of find are replaced.
- AppStream.icon_kind_from_string(kind_str)¶
- Parameters:
kind_str (
str
) – the string.- Returns:
a
AppStream.IconKind
orAppStream.IconKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.icon_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.IconKind
) – theAppStream.IconKind
.- Returns:
string version of kind
- Return type:
Converts the enumerated value to an text representation.
- AppStream.image_kind_from_string(kind)¶
- Parameters:
kind (
str
) – the string.- Returns:
a
AppStream.ImageKind
, orAppStream.ImageKind.UNKNOWN
for unknown.- Return type:
Converts the text representation to an enumerated value.
- AppStream.image_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ImageKind
) – theAppStream.ImageKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.InternetKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 0.15.5.
- AppStream.internet_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.InternetKind
) – theAppStream.InternetKind
.- Returns:
string version of kind
- Return type:
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:
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:
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:
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
orAppStream.IssueKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.issue_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.IssueKind
) – theAppStream.IssueKind
.- Returns:
string version of kind
- Return type:
Converts the enumerated value to an text representation.
- AppStream.issue_severity_from_string(str)¶
- Parameters:
str (
str
) – the string.- Returns:
a
AppStream.IssueSeverity
, orAppStream.IssueSeverity.UNKNOWN
for unknown.- Return type:
Converts the text representation to an enumerated value.
- AppStream.issue_severity_to_string(severity)¶
- Parameters:
severity (
AppStream.IssueSeverity
) – theAppStream.IssueSeverity
.- Returns:
string version of severity
- Return type:
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
orAppStream.LaunchableKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 0.11.0.
- AppStream.launchable_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.LaunchableKind
) – theAppStream.LaunchableKind
.- Returns:
string version of kind
- Return type:
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:
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:
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:
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:
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:
- Returns:
a newly allocated string, or
None
on error.- Return type:
Converts XML description markup into other forms of text.
- AppStream.markup_strsplit_words(text, line_len)¶
-
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
orAppStream.MergeKind.NONE
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.merge_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.MergeKind
) – theAppStream.MergeKind
.- Returns:
string version of kind
- Return type:
Converts the enumerated value to an text representation.
- AppStream.provided_kind_from_string(kind_str)¶
- Parameters:
kind_str (
str
) – the string.- Returns:
a
AppStream.ProvidedKind
orAppStream.ProvidedKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.provided_kind_to_l10n_string(kind)¶
- Parameters:
kind (
AppStream.ProvidedKind
) – theAppStream.ProvidedKind
.- Returns:
Pluralized, l10n string version of kind
- Return type:
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
) – theAppStream.ProvidedKind
.- Returns:
string version of kind
- Return type:
Converts the enumerated value to a text representation.
- AppStream.reference_kind_from_string(str)¶
- Parameters:
str (
str
) – the string.- Returns:
a
AppStream.ReferenceKind
orAppStream.ReferenceKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.reference_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ReferenceKind
) – theAppStream.ReferenceKind
.- Returns:
string version of kind
- Return type:
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
, orAppStream.RelationCompare.UNKNOWN
for unknown.- Return type:
Converts the text representation to an enumerated value.
New in version 0.12.0.
- AppStream.relation_compare_to_string(compare)¶
- Parameters:
compare (
AppStream.RelationCompare
) – theAppStream.RelationCompare
.- Returns:
string version of compare
- Return type:
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
) – theAppStream.RelationCompare
.- Returns:
string version of compare
- Return type:
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_item_kind_from_string(kind_str)¶
- Parameters:
kind_str (
str
) – the string.- Returns:
a
AppStream.RelationItemKind
orAppStream.RelationItemKind.UNKNOWN
for unknown- Return type:
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
) – theAppStream.RelationKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.RelationKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 0.12.0.
- AppStream.relation_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.RelationKind
) – theAppStream.RelationKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.ReleaseKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
New in version 0.12.0.
- AppStream.release_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ReleaseKind
) – theAppStream.ReleaseKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.ReleaseKind.UNKNOWN
for unknown- Return type:
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
) – theAppStream.ReleaseKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.ReleaseUrlKind.UNKNOWN
for unknown- Return type:
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
) – theAppStream.ReleaseUrlKind
.- Returns:
string version of kind
- Return type:
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
, orAppStream.ScreenshotKind.UNKNOWN
if not known.- Return type:
Converts the text representation to an enumerated value.
- AppStream.screenshot_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.ScreenshotKind
) – theAppStream.ScreenshotKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.SizeKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.size_kind_to_string(size_kind)¶
- Parameters:
size_kind (
AppStream.SizeKind
) – theAppStream.SizeKind
.- Returns:
string version of size_kind
- Return type:
Converts the enumerated value to an text representation.
- AppStream.spdx_license_detokenize(license_tokens)¶
- Parameters:
license_tokens (
str
) – license tokens, typically fromAppStream.spdx_license_tokenize
()- Returns:
string, or
None
for invalid- Return type:
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:
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
orAppStream.SuggestedKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.suggested_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.SuggestedKind
) – theAppStream.SuggestedKind
.- Returns:
string version of kind
- Return type:
Converts the enumerated value to an text representation.
- AppStream.system_info_error_quark()¶
- Returns:
An error quark.
- Return type:
New in version 0.16.0.
- AppStream.translation_kind_from_string(kind_str)¶
- Parameters:
kind_str (
str
) – the string.- Returns:
a
AppStream.TranslationKind
orAppStream.TranslationKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.translation_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.TranslationKind
) – theAppStream.TranslationKind
.- Returns:
string version of kind
- Return type:
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
orAppStream.UrgencyKind.UNKNOWN
for unknown- Return type:
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
) – theAppStream.UrgencyKind
.- Returns:
string version of urgency_kind
- Return type:
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
orAppStream.UrlKind.UNKNOWN
for unknown- Return type:
Converts the text representation to an enumerated value.
- AppStream.url_kind_to_string(url_kind)¶
- Parameters:
url_kind (
AppStream.UrlKind
) – theAppStream.UrlKind
.- Returns:
string version of url_kind
- Return type:
Converts the enumerated value to an text representation.
- AppStream.utils_build_data_id(scope, bundle_kind, origin, cid, branch)¶
- Parameters:
scope (
AppStream.ComponentScope
) – Scope of the metadata asAppStream.ComponentScope
e.g.AppStream.ComponentScope.SYSTEM
bundle_kind (
AppStream.BundleKind
) – Bundling system providing this data, e.g. ‘package’ or ‘flatpak’origin (
str
) – Origin string, e.g. ‘os’ or ‘gnome-apps-nightly’cid (
str
) – AppStream component ID, e.g. ‘org.freedesktop.appstream.cli’branch (
str
) – Branch, e.g. ‘3-20’ or ‘master’
- Return type:
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:
- Returns:
True
if the ID’s should be considered equal.- Return type:
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)¶
-
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:
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 aGLib.HashTable
.New in version 0.14.0.
- AppStream.utils_data_id_match(data_id1, data_id2, match_flags)¶
- Parameters:
data_id1 (
str
) – a data IDdata_id2 (
str
) – another data IDmatch_flags (
AppStream.DataIdMatchFlags
) – aAppStream.DataIdMatchFlags
bitfield, e.g.AppStream.DataIdMatchFlags.ID
- Returns:
True
if the IDs should be considered equal.- Return type:
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)¶
-
Checks if a data ID is valid i.e. has the correct number of sections.
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:
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:
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:
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:
- Return type:
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:
location (
AppStream.MetadataLocation
) – theAppStream.MetadataLocation
, e.g.AppStream.MetadataLocation.CACHE
filename (
str
) – the full path of the file to installorigin (
str
) – the origin to use for the installation, orNone
- Raises:
- Returns:
- Return type:
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:
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:
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:
Checks if the given identifier is a valid, known GUI environment style.
New in version 1.0.0.
- AppStream.utils_is_platform_triplet(triplet)¶
-
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:
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:
- Returns:
True
if the locale is compatible.- Return type:
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)¶
-
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:
cpts ([
AppStream.Component
]) – List of components.categories ([
AppStream.Category
]) – List of categories to sort components into.check_duplicates (
bool
) – Whether to check for duplicates.
Sorts all components in cpts into the
AppStream.Category
categories listed in categories.
- AppStream.vercmp(a, b, flags)¶
- Parameters:
a (
str
) – First version numberb (
str
) – Second version numberflags (
AppStream.VercmpFlags
) – Flags, e.g.AppStream.VercmpFlags.NONE
- 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:
Compare alpha and numeric segments of two software versions, considering flags.
- AppStream.vercmp_simple(a, b)¶
- 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:
Compare alpha and numeric segments of two software versions.
- AppStream.vercmp_test_match(ver1, compare, ver2, flags)¶
- Parameters:
ver1 (
str
) – first version numbercompare (
AppStream.RelationCompare
) – the comparison operatorver2 (
str
) – second version numberflags (
AppStream.VercmpFlags
) – theAppStream.VercmpFlags
to use
- Returns:
- Return type:
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:
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
, orAppStream.VideoCodecKind.UNKNOWN
for unknown.- Return type:
Converts the text representation to an enumerated value.
- AppStream.video_codec_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.VideoCodecKind
) – theAppStream.VideoCodecKind
.- Returns:
string version of codec
- Return type:
Converts the enumerated value to an text representation.
- AppStream.video_container_kind_from_string(str)¶
- Parameters:
str (
str
) – the string.- Returns:
a
AppStream.VideoContainerKind
, orAppStream.VideoContainerKind.UNKNOWN
for unknown.- Return type:
Converts the text representation to an enumerated value.
- AppStream.video_container_kind_to_string(kind)¶
- Parameters:
kind (
AppStream.VideoContainerKind
) – theAppStream.VideoContainerKind
.- Returns:
string version of kind
- Return type:
Converts the enumerated value to an text representation.