Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: improve docstring for get_build_provider_flags #4025

Merged
merged 1 commit into from
Jan 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions snapcraft_legacy/cli/_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,9 +354,20 @@ def _param_decls_to_kwarg(key: str) -> str:


def get_build_provider_flags(build_provider: str, **kwargs) -> Dict[str, str]:
"""Get configured options applicable to build_provider."""
"""Get provider options from kwargs for a build provider.

build_provider_flags: Dict[str, str] = dict()
Boolean options that are false are not collected from kwargs.
Options without an environment variable are not collected from kwargs.

:param build_provider: Build provider to collect options for. Valid providers are
'host', 'lxd', 'multipass', and 'managed-host'.
:param kwargs: Dictionary containing provider options.

:return: Dictionary of provider options with their environment variable as the key.

:raises RuntimeError: If build provider is invalid.
"""
build_provider_flags: Dict[str, str] = {}

# Should not happen - developer safety check.
if build_provider not in _ALL_PROVIDERS:
Expand Down