From 14541748de7310f6196dcd78ac4267e8d4664cc5 Mon Sep 17 00:00:00 2001 From: Yun Zheng Hu Date: Tue, 14 Dec 2021 23:46:58 +0100 Subject: [PATCH] Add colorama to Pyinstaller spec and requirements.txt --- log4j-finder.py | 9 ++++++++- log4j-finder.spec | 1 + requirements.txt | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 requirements.txt diff --git a/log4j-finder.py b/log4j-finder.py index 6868501..7f7701e 100755 --- a/log4j-finder.py +++ b/log4j-finder.py @@ -29,8 +29,15 @@ import collections from pathlib import Path +# Optionally import colorama to enable colored output for Windows +try: + import colorama + colorama.init() + NO_COLOR = False +except ImportError: + NO_COLOR = True if sys.platform == 'win32' else False + log = logging.getLogger(__name__) -NO_COLOR = False # Java Archive Extensions JAR_EXTENSIONS = (".jar", ".war", ".ear") diff --git a/log4j-finder.spec b/log4j-finder.spec index f2cc373..9e6e59b 100644 --- a/log4j-finder.spec +++ b/log4j-finder.spec @@ -5,6 +5,7 @@ block_cipher = None a = Analysis(['log4j-finder.py'], + hiddenimports=['colorama'], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..3fcfb51 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +colorama