qgis_deployment_toolbelt.commands.upgrade module#

Sub-command in charge of checking if new versions are available.

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

qgis_deployment_toolbelt.commands.upgrade.get_download_url_for_os(release_assets: list, override_opersys: str | None = None) tuple[str | None, str | None]#

Parse list of a GitHub release assets and return the appropriate download URL for the current operating system.

Parameters:
  • release_assets (list) – list of assets

  • override_opersys (str, optional) – override current operating system code. Useful to get a download URL for a specific OS. Defaults to None.

Returns:

tuple containing asset download URL (browser_download_url) and

content-type (barely defined)

Return type:

tuple[str, str]

qgis_deployment_toolbelt.commands.upgrade.get_latest_release(api_repo_url: str) dict | None#

Get latest release from GitHub public API.

Parameters:

api_repo_url (str) – API URL with the owner and repository set

Returns:

GitHub release object

Return type:

dict

qgis_deployment_toolbelt.commands.upgrade.parser_upgrade(subparser: ArgumentParser) ArgumentParser#

Set the argument parser subcommand.

Parameters:

subparser (argparse.ArgumentParser) – parser to set up

Returns:

parser ready to use

Return type:

argparse.ArgumentParser

qgis_deployment_toolbelt.commands.upgrade.replace_domain(url: str, new_domain: str = 'api.github.com/repos') str#

Replaces the domain of an URL with a new domain.

Parameters:
  • url (str) – The original URL.

  • new_domain (str, optional) – The new domain to replace the original domain with. Defaults to “api.github.com/repos”.

Returns:

The URL with the new domain.

Return type:

str

qgis_deployment_toolbelt.commands.upgrade.run(args: Namespace)#

Run the sub command logic.

Check if a new version of the CLI is available and download it if needed.

Parameters:

args (argparse.Namespace) – arguments passed to the subcommand