AppStreamCompose.Compose

g AppStreamCompose.Compose AppStreamCompose.Compose GObject.Object GObject.Object GObject.Object->AppStreamCompose.Compose

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new ()

add_allowed_cid (component_id)

add_custom_allowed (key_id)

add_flags (flags)

add_unit (unit)

fetch_components ()

finalize_result (result)

finalize_results ()

get_cainfo ()

get_data_result_dir ()

get_flags ()

get_format ()

get_hints_result_dir ()

get_icon_policy ()

get_icons_result_dir ()

get_locale_unit ()

get_max_screenshot_size ()

get_media_baseurl ()

get_media_result_dir ()

get_origin ()

get_prefix ()

get_results ()

has_errors ()

remove_custom_allowed (key_id)

remove_flags (flags)

reset ()

run (cancellable)

set_cainfo (cainfo)

set_check_metadata_early_func (func, *user_data)

set_data_result_dir (dir)

set_flags (flags)

set_format (kind)

set_hints_result_dir (dir)

set_icon_policy (policy)

set_icons_result_dir (dir)

set_locale_unit (locale_unit)

set_max_screenshot_size (size_bytes)

set_media_baseurl (url)

set_media_result_dir (dir)

set_origin (origin)

set_prefix (prefix)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

None

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class AppStreamCompose.Compose(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

AppStreamCompose.ComposeClass

classmethod new()
Return type:

AppStreamCompose.Compose

Creates a new AppStreamCompose.Compose.

add_allowed_cid(component_id)
Parameters:

component_id (str) – The component-id to whitelist

Adds a component ID to the allowlist. If the list is not empty, only components in the list will be added to the metadata output.

add_custom_allowed(key_id)
Parameters:

key_id (str) – the custom key to add to the allowed list.

Add a key to the allowlist that is used to filter custom tag values.

add_flags(flags)
Parameters:

flags (AppStreamCompose.ComposeFlags) – The compose flags to add.

Add compose flags.

add_unit(unit)
Parameters:

unit (AppStreamCompose.Unit) – The AppStreamCompose.Unit to add

Add an AppStreamCompose.Unit as data source for metadata processing.

fetch_components()
Returns:

The components

Return type:

[AppStream.Component]

Get the results components extracted in the last data processing run.

finalize_result(result)
Parameters:

result (AppStreamCompose.Result) – the AppStreamCompose.Result to finalize

Perform final validation of generated data for the specified result container.

finalize_results()

Perform final validation of generated data. Calling this function is not necessary, unless the final check was explicitly disabled using the AppStreamCompose.ComposeFlags.NO_FINAL_CHECK flag.

get_cainfo()
Return type:

str

Get the CA file used to verify peers with, or None for default.

get_data_result_dir()
Return type:

str

Get the data result directory.

get_flags()
Return type:

AppStreamCompose.ComposeFlags

Get the flags controlling compose behavior.

get_format()
Return type:

AppStream.FormatKind

get the format type we are generating.

get_hints_result_dir()
Return type:

str

Get hints report output directory.

get_icon_policy()
Returns:

an AppStreamCompose.IconPolicy

Return type:

AppStreamCompose.IconPolicy

Get the policy for how icons should be distributed to any AppStream clients.

get_icons_result_dir()
Return type:

str

Get the icon result directory.

get_locale_unit()
Returns:

The unit used for locale processing, or None for default.

Return type:

AppStreamCompose.Unit or None

Get the unit we use for locale processing

get_max_screenshot_size()
Return type:

int

Get the maximum size a screenshot video or image can have. A size < 0 may be returned for no limit, setting a limit of 0 will disable screenshots.

get_media_baseurl()
Return type:

str

Get the media base URL to be used for the generated data, or None if no media is cached.

get_media_result_dir()
Return type:

str

Get the media result directory, that can be served on a webserver.

get_origin()
Return type:

str

Get the metadata origin field.

get_prefix()
Return type:

str

Get the directory prefix used for processing.

get_results()
Returns:

The results

Return type:

[AppStreamCompose.Result]

Get the results of the last processing run.

has_errors()
Returns:

True if we had errors.

Return type:

bool

Check if the last run generated any errors (which will cause metadata to be ignored).

remove_custom_allowed(key_id)
Parameters:

key_id (str) – the custom key to drop from the allowed list.

Remove a key from the allowlist used to filter the <custom/> tag entries.

remove_flags(flags)
Parameters:

flags (AppStreamCompose.ComposeFlags) – The compose flags to remove.

Remove compose flags.

reset()

Reset the results, units and run-specific settings so the instance can be reused for another metadata generation run.

run(cancellable)
Parameters:

cancellable (Gio.Cancellable or None) – a Gio.Cancellable.

Raises:

GLib.Error

Returns:

The results, or None on error

Return type:

[AppStreamCompose.Result]

Process the registered units and generate catalog metadata from found components.

set_cainfo(cainfo)
Parameters:

cainfo (str) – a valid file path

Set a CA file holding one or more certificates to verify peers with for download operations performed by this AppStreamCompose.Compose.

set_check_metadata_early_func(func, *user_data)
Parameters:

Set an custom callback to be run when most of the metadata has been loaded, but no expensive operations (like downloads or icon rendering) have been done yet. This can be used to ignore unwanted components early on.

The callback function may be called from any thread, so it needs to ensure thread safety on its own.

set_data_result_dir(dir)
Parameters:

dir (str) – the metadata save location.

Set an output location where generated metadata should be saved. If this is set to None, no metadata will be saved.

set_flags(flags)
Parameters:

flags (AppStreamCompose.ComposeFlags) – The compose flags bitfield.

Set compose flags bitfield that controls the enabled features for this AppStreamCompose.Compose.

set_format(kind)
Parameters:

kind (AppStream.FormatKind) – The format, e.g. AppStream.FormatKind.XML

Set the format kind of the catalog metadata that we should generate.

set_hints_result_dir(dir)
Parameters:

dir (str) – the hints data directory.

Set an output location for HTML reports of issues generated during a compose run.

set_icon_policy(policy)
Parameters:

policy (AppStreamCompose.IconPolicy) – an AppStreamCompose.IconPolicy instance

Set an icon policy object, overriding the existing one.

set_icons_result_dir(dir)
Parameters:

dir (str) – the icon storage location.

Set an output location where plain icons for the processed metadata are stored.

set_locale_unit(locale_unit)
Parameters:

locale_unit (AppStreamCompose.Unit) – the unit used for locale processing.

Set a specific unit that is used for fetching locale information. This may be useful in case a special language pack layout is used, but is generally not necessary to be set explicitly, as locale will be found in the unit where the metadata is by default.

set_max_screenshot_size(size_bytes)
Parameters:

size_bytes (int) – maximum size of a screenshot image or video in bytes

Set the maximum size a screenshot video or image can have. A size < 0 may be set to allow unlimited sizes, setting a limit of 0 will disable screenshot caching entirely.

set_media_baseurl(url)
Parameters:

url (str or None) – the media base URL.

Set the media base URL for the generated metadata. Can be None if no media should be cached and the original URLs should be kept.

set_media_result_dir(dir)
Parameters:

dir (str) – the media storage location.

Set an output location to store media (screenshots, icons, …) that will be served on a webserver via the URL set as media baseurl.

set_origin(origin)
Parameters:

origin (str) – the origin.

Set the metadata origin field (e.g. “debian” or “flathub”)

set_prefix(prefix)
Parameters:

prefix (str) – a directory prefix, e.g. “/usr”

Set the directory prefix the to-be-processed units are using.