AppStreamCompose.Compose¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
|---|---|---|---|
parent_instance |
r |
Class Details¶
- class AppStreamCompose.Compose(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Return type:
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) – TheAppStreamCompose.Unitto add
Add an
AppStreamCompose.Unitas data source for metadata processing.Added in version 0.14.5.
- fetch_components()¶
- Returns:
The components
- Return type:
Get the results components extracted in the last data processing run.
Added in version 0.14.5.
- finalize_result(result)¶
- Parameters:
result (
AppStreamCompose.Result) – theAppStreamCompose.Resultto 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_CHECKflag.Added in version 0.15.1.
- get_cainfo()¶
- Return type:
Get the CA file used to verify peers with, or
Nonefor default.Added in version 0.15.2.
- get_flags()¶
- Return type:
Get the flags controlling compose behavior.
Added in version 0.14.5.
- get_format()¶
- Return type:
get the format type we are generating.
Added in version 0.14.5.
- get_hints_result_dir()¶
- Return type:
Get hints report output directory.
Added in version 0.14.5.
- get_icon_policy()¶
- Returns:
- Return type:
Get the policy for how icons should be distributed to any AppStream clients.
Added in version 0.15.1.
- get_image_format()¶
- Return type:
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
Nonefor default.- Return type:
Get the unit we use for locale processing
Added in version 0.15.1.
- get_max_screenshot_size()¶
- Return type:
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:
Get the media base URL to be used for the generated data, or
Noneif no media is cached.Added in version 0.14.5.
- get_media_result_dir()¶
- Return type:
Get the media result directory, that can be served on a webserver.
Added in version 0.14.5.
- get_prefix()¶
- Return type:
Get the directory prefix used for processing.
Added in version 0.14.5.
- get_results()¶
- Returns:
The results
- Return type:
Get the results of the last processing run.
Added in version 0.14.5.
- has_errors()¶
-
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.CancellableorNone) – aGio.Cancellable.- Raises:
- Returns:
The results, or
Noneon error- Return type:
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:
func (
AppStreamCompose.CheckMetadataEarlyFnorNone) – theAppStreamCompose.CheckMetadataEarlyFnfunction to be called
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:
func (
AppStreamCompose.TranslateDesktopTextFnorNone) – theAppStreamCompose.TranslateDesktopTextFnfunction to be called
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) – anAppStreamCompose.IconPolicyinstance
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) andAppStreamCompose.ImageFormat.PNGhere, 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.MediaorNone) – anAppStreamCompose.Mediainstance, orNone
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.Mediaitself or that composes many units in sequence to amortize the cost of starting a second media worker.An
AppStreamCompose.Mediainstance must never be used by more than one thread, so while a media object is set,AppStreamCompose.Composewill always process its units sequentially, ignoringAppStreamCompose.ComposeFlags.USE_THREADS. PassNoneto restore the default behavior of using one media instance per unit.Added in version 1.2.0.
- set_media_baseurl(url)¶
-
Set the media base URL for the generated metadata. Can be
Noneif 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.