From bbf51bcb3106c09630bdcfdc476e744cd85395a3 Mon Sep 17 00:00:00 2001 From: Lukas Puehringer Date: Wed, 26 Oct 2022 11:33:38 +0200 Subject: [PATCH] Remove colorama optional dependency The coloroma library was used to optionally colorize the private key file path in a password prompt, for encryption or decryption. Given that the feature is in a rarely used code path -- interactive calls are unlikely to be used outside of demo contexts -- and its merit it generally debatable, our broad goal to minimize dependencies weighs stronger. Signed-off-by: Lukas Puehringer --- requirements-pinned.txt | 1 - requirements.txt | 1 - securesystemslib/interface.py | 16 ++-------------- setup.py | 1 - 4 files changed, 2 insertions(+), 17 deletions(-) diff --git a/requirements-pinned.txt b/requirements-pinned.txt index 708464a8..e491bb48 100644 --- a/requirements-pinned.txt +++ b/requirements-pinned.txt @@ -1,5 +1,4 @@ cffi==1.15.1 # via cryptography, pynacl -colorama==0.4.5 cryptography==38.0.2 pycparser==2.21 # via cffi pynacl==1.5.0 diff --git a/requirements.txt b/requirements.txt index aafc29a8..86ace54f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -33,4 +33,3 @@ # cryptography >= 37.0.0; python_version >= '3' pynacl -colorama diff --git a/securesystemslib/interface.py b/securesystemslib/interface.py index 4238bfdb..972e9076 100644 --- a/securesystemslib/interface.py +++ b/securesystemslib/interface.py @@ -41,18 +41,6 @@ logger = logging.getLogger(__name__) -try: - from colorama import Fore - - TERM_RED = Fore.RED - TERM_RESET = Fore.RESET -except ImportError: # pragma: no cover - logger.debug( - "Failed to find colorama module, terminal output won't be colored" - ) - TERM_RED = "" - TERM_RESET = "" - # Recommended RSA key sizes: # https://en.wikipedia.org/wiki/Key_size#Asymmetric_algorithm_key_lengths # Based on the above, RSA keys of size 3072 bits are expected to provide @@ -115,7 +103,7 @@ def _get_key_file_encryption_password(password, prompt, path): if prompt: password = get_password( "enter password to encrypt private key file " - "'" + TERM_RED + str(path) + TERM_RESET + "' (leave empty if key " + "'" + str(path) + "' (leave empty if key " "should not be encrypted): ", confirm=True, ) @@ -162,7 +150,7 @@ def _get_key_file_decryption_password(password, prompt, path): if prompt: password = get_password( "enter password to decrypt private key file " - "'" + TERM_RED + str(path) + TERM_RESET + "' " + "'" + str(path) + "' " "(leave empty if key not encrypted): ", confirm=False, ) diff --git a/setup.py b/setup.py index 5763dd42..af0fbc0e 100644 --- a/setup.py +++ b/setup.py @@ -100,7 +100,6 @@ }, python_requires="~=3.7", extras_require={ - "colors": ["colorama>=0.3.9"], "crypto": ["cryptography>=37.0.0"], "pynacl": ["pynacl>1.2.0"], },