From ffbccdfe9649da09ebccbc3e2663fb61f254ffb7 Mon Sep 17 00:00:00 2001 From: Brian Rutledge Date: Sat, 26 Feb 2022 21:28:39 -0500 Subject: [PATCH] Log warning for gpg --- twine/package.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/twine/package.py b/twine/package.py index 5065aba1..168f9665 100644 --- a/twine/package.py +++ b/twine/package.py @@ -13,6 +13,7 @@ # limitations under the License. import hashlib import io +import logging import os import re import subprocess @@ -44,6 +45,8 @@ MetadataValue = Union[str, Sequence[str]] +logger = logging.getLogger(__name__) + def _safe_name(name: str) -> str: """Convert an arbitrary string to a standard distribution name. @@ -226,12 +229,12 @@ def run_gpg(cls, gpg_args: Tuple[str, ...]) -> None: f"{gpg_args[0]} executable not available." ) - print("[yellow]gpg executable not available. Attempting fallback to gpg2.") + logger.warning("gpg executable not available. Attempting fallback to gpg2.") try: subprocess.check_call(("gpg2",) + gpg_args[1:]) except FileNotFoundError: raise exceptions.InvalidSigningExecutable( - "'gpg' or 'gpg2' executables not available. " + "'gpg' or 'gpg2' executables not available.\n" "Try installing one of these or specifying an executable " "with the --sign-with flag." )