Skip to content

Commit

Permalink
Get rid of GPG constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
znewman01 committed Oct 13, 2022
1 parent 19ba269 commit c879125
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 71 deletions.
53 changes: 0 additions & 53 deletions securesystemslib/gpg/_lazy.py

This file was deleted.

18 changes: 0 additions & 18 deletions securesystemslib/gpg/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
import logging
import os

import securesystemslib.gpg._lazy as lazy

from securesystemslib import process

log = logging.getLogger(__name__)
Expand Down Expand Up @@ -55,23 +53,14 @@ def gpg_command() -> str:
return GPG1_COMMAND
return ""

GPG_COMMAND = lazy.wrap_thunk(gpg_command)


def have_gpg() -> bool:
"""Returns True if a gpg_command is available."""
return bool(gpg_command())

HAVE_GPG = lazy.wrap_thunk(have_gpg)


def gpg_version_command() -> str:
"""Returns the command to get the current GPG version."""
return f"{gpg_command()} --version"

GPG_VERSION_COMMAND = lazy.wrap_thunk(gpg_version_command)


FULLY_SUPPORTED_MIN_VERSION = "2.1.0"
NO_GPG_MSG = (
f"GPG support requires a GPG client. 'gpg2' or 'gpg' with version "
Expand All @@ -82,17 +71,10 @@ def gpg_sign_command(keyarg: str, homearg: str) -> str:
"""Returns the command to use GPG to sign STDIN."""
return f"{gpg_command()} --detach-sign --digest-algo SHA256 {keyarg} {homearg}"

GPG_SIGN_COMMAND = lazy.wrap_thunk(lambda: gpg_sign_command("{keyarg}", "{homearg}"))


def gpg_export_pubkey_command(homearg: str, keyid: str):
"""Returns the GPG command to export a public key."""
return f"{gpg_command()} {homearg} --export {keyid}"

GPG_EXPORT_PUBKEY_COMMAND = lazy.wrap_thunk(
lambda: gpg_export_pubkey_command("{homearg}", "{keyid}")
)

# See RFC4880 section 4.3. Packet Tags for a list of all packet types The
# relevant packets defined below are described in sections 5.2 (signature),
# 5.5.1.1 (primary pubkey) and 5.5.1.2 (pub subkey), 5.12 (user id) and 5.13
Expand Down

0 comments on commit c879125

Please sign in to comment.