From 82432179e0fcb17aa845e5fbb97c127c67cfce20 Mon Sep 17 00:00:00 2001 From: "Robert P. J. Day" Date: Fri, 14 Apr 2023 06:10:29 -0400 Subject: [PATCH] _options.py: use short form variables for listing providers Given that this file defines the helper variables: _SUPPORTED_PROVIDERS = ["host", "lxd", "multipass"] _HIDDEN_PROVIDERS = ["managed-host"] _ALL_PROVIDERS = _SUPPORTED_PROVIDERS + _HIDDEN_PROVIDERS it seems a waste not to use them for brevity. Signed-off-by: Robert P. J. Day --- snapcraft_legacy/cli/_options.py | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/snapcraft_legacy/cli/_options.py b/snapcraft_legacy/cli/_options.py index a0e0ab653b..d828412530 100644 --- a/snapcraft_legacy/cli/_options.py +++ b/snapcraft_legacy/cli/_options.py @@ -75,32 +75,32 @@ def __repr__(self): param_decls=["--target-arch"], metavar="", help="Target architecture to cross compile to", - supported_providers=["host", "lxd", "multipass"], + supported_providers=_SUPPORTED_PROVIDERS, ), dict( param_decls=["--debug"], is_flag=True, help="Shells into the environment if the build fails.", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--shell"], is_flag=True, help="Shells into the environment in lieu of the step to run.", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--offline"], is_flag=True, help="Operate in offline mode.", envvar="SNAPCRAFT_OFFLINE", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--shell-after"], is_flag=True, help="Shells into the environment after the step has run.", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--destructive-mode"], @@ -128,14 +128,14 @@ def __repr__(self): metavar="", help="HTTP proxy for host build environments.", envvar="http_proxy", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--https-proxy"], metavar="", help="HTTPS proxy for host build environments.", envvar="https_proxy", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--add-ca-certificates"], @@ -159,7 +159,7 @@ def __repr__(self): is_flag=True, help="Enable developer debug logging.", envvar="SNAPCRAFT_ENABLE_DEVELOPER_DEBUG", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, hidden=True, ), dict( @@ -168,7 +168,7 @@ def __repr__(self): type=BoolParamType(), help="Generate snap manifest.", envvar="SNAPCRAFT_BUILD_INFO", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, hidden=True, ), dict( @@ -176,7 +176,7 @@ def __repr__(self): metavar="", help="Set snap manifest image-info", envvar="SNAPCRAFT_IMAGE_INFO", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, hidden=True, ), dict( @@ -184,34 +184,34 @@ def __repr__(self): is_flag=True, help="Enable extensions that are experimental and not considered stable.", envvar="SNAPCRAFT_ENABLE_EXPERIMENTAL_EXTENSIONS", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--enable-experimental-target-arch"], is_flag=True, help="Enable experimental `--target-arch` support for core20.", envvar="SNAPCRAFT_ENABLE_EXPERIMENTAL_TARGET_ARCH", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--ua-token"], metavar="", help="Configure build environment with ESM using specified UA token.", envvar="SNAPCRAFT_UA_TOKEN", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--enable-experimental-ua-services"], is_flag=True, help="Allow selection of UA services to enable.", envvar="SNAPCRAFT_ENABLE_EXPERIMENTAL_UA_SERVICES", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), dict( param_decls=["--verbose", "-v"], is_flag=True, help="Show debug information and be more verbose.", - supported_providers=["host", "lxd", "managed-host", "multipass"], + supported_providers=_ALL_PROVIDERS, ), ]