Skip to content

Commit

Permalink
Log warning for gpg
Browse files Browse the repository at this point in the history
  • Loading branch information
bhrutledge committed Feb 27, 2022
1 parent cf11941 commit 93688ae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions twine/package.py
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
import hashlib
import io
import logging
import os
import re
import subprocess
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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."
)
Expand Down

0 comments on commit 93688ae

Please sign in to comment.