From 637d9dcb459de7bb320c63353d922219255b0e9a Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 8 Oct 2025 14:32:38 +0200 Subject: [PATCH] Bump click version to allow 8.3 --- pulp_cli/generic.py | 16 +++++++++++++++- pyproject.toml | 2 +- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/pulp_cli/generic.py b/pulp_cli/generic.py index 26089d8bf..174ab432c 100644 --- a/pulp_cli/generic.py +++ b/pulp_cli/generic.py @@ -49,6 +49,20 @@ else: SECRET_STORAGE = True +try: + # Sentinel is introduced in click 8.3. + # We need to use it to identify unset values. + _UNSET = click._utils.Sentinel.UNSET # type: ignore[attr-defined] + + def _unset(value: t.Any) -> bool: + return value is _UNSET or value is None or value == () or value == [] + +except AttributeError: + + def _unset(value: t.Any) -> bool: + return value is None or value == () or value == [] + + translation = get_translation(__package__) _ = translation.gettext @@ -474,7 +488,7 @@ def __init__( super().__init__(*args, **kwargs) def process_value(self, ctx: click.Context, value: t.Any) -> t.Any: - if self.needs_plugins and value is not None and value != (): + if self.needs_plugins and not _unset(value): pulp_ctx = ctx.find_object(PulpCLIContext) assert pulp_ctx is not None for plugin_requirement in self.needs_plugins: diff --git a/pyproject.toml b/pyproject.toml index 933e97e67..88d5d0eb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers=[ ] dependencies = [ "pulp-glue==0.37.0.dev", - "click>=8.0.0,<8.3", # Proven to not do semver. + "click>=8.0.0,<8.4", # Proven to not do semver. "PyYAML>=5.3,<6.1", "schema>=0.7.5,<0.8", "tomli>=2.0.0,<2.1;python_version<'3.11'",