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_image_format ()

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_desktop_entry_l10n_func (func, *user_data)

set_flags (flags)

set_format (kind)

set_hints_result_dir (dir)

set_icon_policy (policy)

set_icons_result_dir (dir)

set_image_format (format)

set_locale_unit (locale_unit)

set_max_screenshot_size (size_bytes)

set_media (media)

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.

Added in version 0.14.5.

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.

Added in version 0.14.5.

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.

Added in version 0.15.1.

add_flags(flags)
Parameters:

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

Add compose flags.

Added in version 0.15.1.

add_unit(unit)
Parameters:

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

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

Added in version 0.14.5.

fetch_components()
Returns:

The components

Return type:

[AppStream.Component]

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

Added in version 0.14.5.

finalize_result(result)
Parameters:

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

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

Added in version 0.15.1.

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.

Added in version 0.15.1.

get_cainfo()
Return type:

str

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

Added in version 0.15.2.

get_data_result_dir()
Return type:

str

Get the data result directory.

Added in version 0.14.5.

get_flags()
Return type:

AppStreamCompose.ComposeFlags

Get the flags controlling compose behavior.

Added in version 0.14.5.

get_format()
Return type:

AppStream.FormatKind

get the format type we are generating.

Added in version 0.14.5.

get_hints_result_dir()
Return type:

str

Get hints report output directory.

Added in version 0.14.5.

get_icon_policy()
Returns:

an AppStreamCompose.IconPolicy

Return type:

AppStreamCompose.IconPolicy

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

Added in version 0.15.1.

get_icons_result_dir()
Return type:

str

Get the icon result directory.

Added in version 0.14.5.

get_image_format()
Return type:

AppStreamCompose.ImageFormat

Get the file format that generated icons and screenshots are stored in. This is unrelated to AppStreamCompose.Compose.get_format, which selects the format of the generated catalog metadata.

Added in version 1.2.0.

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

Added in version 0.15.1.

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.

Added in version 0.15.1.

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.

Added in version 0.14.5.

get_media_result_dir()
Return type:

str

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

Added in version 0.14.5.

get_origin()
Return type:

str

Get the metadata origin field.

Added in version 0.14.5.

get_prefix()
Return type:

str

Get the directory prefix used for processing.

Added in version 0.14.5.

get_results()
Returns:

The results

Return type:

[AppStreamCompose.Result]

Get the results of the last processing run.

Added in version 0.14.5.

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).

Added in version 0.14.5.

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.

Added in version 0.15.1.

remove_flags(flags)
Parameters:

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

Remove compose flags.

Added in version 0.15.1.

reset()

Drop the results, the registered units and the allowed component-ID list of the last run, so the instance can be reused for another metadata generation run. Everything else - flags, result directories, icon policy, media instance, locale unit, allowed custom keys and the callbacks - is retained.

Added in version 0.14.5.

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.

Added in version 0.14.5.

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.

Added in version 0.15.2.

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.

Any previously set callback is replaced, and its user data released using the destroy function it was registered with.

Added in version 0.15.1.

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.

Added in version 0.14.5.

set_desktop_entry_l10n_func(func, *user_data)
Parameters:

Set a custom desktop-entry field localization functions to be run for specialized desktop-entry localization schemes such as used in Ubuntu.

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

Any previously set callback is replaced, and its user data released using the destroy function it was registered with.

Added in version 0.15.1.

set_flags(flags)
Parameters:

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

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

Added in version 0.14.5.

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.

Added in version 0.14.5.

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.

Added in version 0.14.5.

set_icon_policy(policy)
Parameters:

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

Set an icon policy object, overriding the existing one.

Added in version 0.15.1.

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.

Added in version 0.14.5.

set_image_format(format)
Parameters:

format (AppStreamCompose.ImageFormat) – The image format, e.g. AppStreamCompose.ImageFormat.JXL

Set the file format that generated icons and screenshots should be stored in. We only support AppStreamCompose.ImageFormat.JXL (the default) and AppStreamCompose.ImageFormat.PNG here, any other format is rejected.

Please note that JPEG-XL images can not be read by older AppStream clients, so PNG may be selected for backwards compatibility.

Added in version 1.2.0.

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.

Do not forget to open the locale unit, before running compose actions with it!

Added in version 0.15.1.

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.

Added in version 0.15.1.

set_media(media)
Parameters:

media (AppStreamCompose.Media or None) – an AppStreamCompose.Media instance, or None

Set a media processing interface to use for every unit that this compose object processes (otherwise it will create a fresh one per unit/thread that it uses). This allows a caller that wants to use an AppStreamCompose.Media itself or that composes many units in sequence to amortize the cost of starting a second media worker.

An AppStreamCompose.Media instance must never be used by more than one thread, so while a media object is set, AppStreamCompose.Compose will always process its units sequentially, ignoring AppStreamCompose.ComposeFlags.USE_THREADS. Pass None to restore the default behavior of using one media instance per unit.

Added in version 1.2.0.

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.

Added in version 0.14.5.

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.

Added in version 0.14.5.

set_origin(origin)
Parameters:

origin (str) – the origin.

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

Added in version 0.14.5.

set_prefix(prefix)
Parameters:

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

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

Added in version 0.14.5.