qgis_deployment_toolbelt.jobs.job_profiles_synchronizer module

Synchronize profiles between downloaded (in QDT working folder) and installed

profiles (in QGIS profiles’folder).

Author: Julien Moura (https://github.com/guts)

class qgis_deployment_toolbelt.jobs.job_profiles_synchronizer.JobProfilesSynchronizer(options: dict)

Bases: GenericJob

Job to synchronize profiles between downloaded (in QDT working folder) and installed

profiles (in QGIS profiles’folder).

ID: str = 'qprofiles-synchronizer'
OPTIONS

alias of ProfilesSynchronizerOptions

PROFILES_NAMES_DOWNLOADED: list = []
PROFILES_NAMES_INSTALLED: list = []
__init__(options: dict) → None

Instantiate the class.

Parameters:

options (dict) – options set in the with key of the scenario step, see ProfilesSynchronizerOptions

_abc_impl = <_abc._abc_data object>
compare_downloaded_with_installed_profiles(li_downloaded_profiles: Iterable[QdtProfile]) → tuple[list[QdtProfile], list[QdtProfile], list[QdtProfile]]
Compare versions between downloaded (in QDT working folder) and installed

(in QGIS) profiles.

Parameters:

li_downloaded_profiles (Iterable[QdtProfile]) – downloaded profiles.

Returns:

a tuple with the following structure ( list of installed profiles and outdated (lesser version number), list of installed profiles with a different version (lesser or greater), list of profiles with the same version number in downloaded/installed )

Return type:

tuple[list[QdtProfile], list[QdtProfile], list[QdtProfile]]

run() → None

Execute job logic.

sync_installed_profiles_from_downloaded_profiles(downloaded_profiles: Iterable[QdtProfile]) → None
Copy downloaded profiles to QGIS profiles folder. If the QGIS profiles folder

doesn’t exist, it will be created and every downloaded profile will be copied. If a profile is already installed, it won’t be overwritten.

Parameters:

downloaded_profiles (tuple[QdtProfile]) – list of downloaded profiles objects

sync_overwrite_local_profiles(profiles_to_copy: tuple[QdtProfile], overwrite: bool = False) → None

Overwrite local profiles with downloaded ones.

Parameters:
  • profiles_to_copy (tuple[QdtProfile]) – tuple of profiles to copy

  • overwrite (bool) – overwrite profile if it exists (default False)

write_qdt_watermark(downloaded_profile: QdtProfile, installed_profile: QdtProfile) → Path
Write QDT metadata into the settings file (QGIS3.ini, QGIS4.ini…) of an

installed profile, in the section set by the qdt_watermark option.

Parameters:
  • downloaded_profile (QdtProfile) – downloaded profile, source of the metadata

  • installed_profile (QdtProfile) – installed profile to write into

Returns:

path to the written settings file

Return type:

Path

class qgis_deployment_toolbelt.jobs.job_profiles_synchronizer.ProfilesSynchronizerOptions(*, qdt_watermark: Literal['none', 'section', 'variables'] = 'none', sync_mode: Literal['only_missing', 'only_different_version', 'only_new_version', 'overwrite'] = 'only_missing')

Bases: JobOptions

Options of the qprofiles-synchronizer job.

_abc_impl = <_abc._abc_data object>
model_config = {'extra': 'forbid', 'frozen': True, 'strict': True, 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

qdt_watermark: Literal['none', 'section', 'variables']
sync_mode: Literal['only_missing', 'only_different_version', 'only_new_version', 'overwrite']