Skip to content

Commit

Permalink
Merge pull request #543 from lukpueh/allow-patch-timeout
Browse files Browse the repository at this point in the history
gpg: set default in function to allow global patch
  • Loading branch information
lukpueh authored Mar 21, 2023
2 parents 93c9329 + 4d7b693 commit 4da1e0e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions securesystemslib/gpg/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,19 @@
import os
import shlex
import subprocess # nosec
from typing import List
from typing import List, Optional

log = logging.getLogger(__name__)

GPG_TIMEOUT = 10


@functools.lru_cache(maxsize=3)
def is_available_gnupg(gnupg: str, timeout=GPG_TIMEOUT) -> bool:
def is_available_gnupg(gnupg: str, timeout: Optional[int] = None) -> bool:
"""Returns whether gnupg points to a gpg binary."""
if timeout is None:
timeout = GPG_TIMEOUT

gpg_version_cmd = shlex.split(f"{gnupg} --version")
try:
subprocess.run( # nosec
Expand Down

0 comments on commit 4da1e0e

Please sign in to comment.