From 0d0e93a05235e8aecab5a9ddd491043a832c3432 Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Wed, 11 Sep 2024 17:17:48 +0200 Subject: [PATCH] Fix stray click import in pulp-glue Pulp GLUE deliberately does not depend on click. For echoing status messages, PulpContext.echo should be used. (cherry picked from commit 156bca93693fe77d69a7a474d9974c8c6178d032) --- pulp-glue/pulp_glue/common/context.py | 4 ++-- pulp-glue/pulp_glue/rpm/context.py | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/pulp-glue/pulp_glue/common/context.py b/pulp-glue/pulp_glue/common/context.py index a60d0e6a8..1eabad9b3 100644 --- a/pulp-glue/pulp_glue/common/context.py +++ b/pulp-glue/pulp_glue/common/context.py @@ -239,9 +239,8 @@ def echo(self, message: str, nl: bool = True, err: bool = False) -> None: Abstract function that will be called to emit warnings and task progress. Warning: - This function needs to be implemented. + This function does nothing until implemented by a subclass. """ - raise NotImplementedError("PulpContext is an abstract class.") def prompt(self, text: str, hide_input: bool = False) -> str: """ @@ -249,6 +248,7 @@ def prompt(self, text: str, hide_input: bool = False) -> str: Note: If a password is provided non-interactively, this function need not be implemented. + Doing so is deprecated. """ raise NotImplementedError("PulpContext is an abstract class.") diff --git a/pulp-glue/pulp_glue/rpm/context.py b/pulp-glue/pulp_glue/rpm/context.py index ef615d159..4fee5d61b 100644 --- a/pulp-glue/pulp_glue/rpm/context.py +++ b/pulp-glue/pulp_glue/rpm/context.py @@ -1,7 +1,5 @@ import typing as t -import click - from pulp_glue.common.context import ( EntityDefinition, PluginRequirement, @@ -70,7 +68,7 @@ class PulpRpmCompsXmlContext(PulpEntityContext): def upload_comps( self, file: t.IO[bytes], repo_href: t.Optional[str], replace: t.Optional[bool] ) -> t.Any: - click.echo(_("Uploading file {filename}").format(filename=file.name), err=True) + self.pulp_ctx.echo(_("Uploading file {filename}").format(filename=file.name), err=True) file.seek(0) return self.call( "upload_comps",