From 3f6ba3a2c47b5eef24d670bc30026d36ce428e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Milkovi=C4=8D?= Date: Fri, 8 Jan 2021 01:31:45 +0100 Subject: [PATCH] Do not fail complately when retdec-archive-decompiler is not available --- scripts/retdec-fileinfo.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/retdec-fileinfo.py b/scripts/retdec-fileinfo.py index 3a9fadf3..53207850 100644 --- a/scripts/retdec-fileinfo.py +++ b/scripts/retdec-fileinfo.py @@ -15,10 +15,12 @@ import sys utils = importlib.import_module('retdec-utils') utils.check_python_version() utils.ensure_script_is_being_run_from_installed_retdec() -retdec_archive_decompiler = importlib.import_module('retdec-archive-decompiler') - -ArchiveDecompiler = retdec_archive_decompiler.ArchiveDecompiler +try: + retdec_archive_decompiler = importlib.import_module('retdec-archive-decompiler') + ArchiveDecompiler = retdec_archive_decompiler.ArchiveDecompiler +except ImportError: + ArchiveDecompiler = None sys.stdout = utils.Unbuffered(sys.stdout) @@ -78,6 +80,7 @@ def main(): if args.json: archive_decompiler_args.append('--json') + assert ArchiveDecompiler is not None, "You need to install RetDec with Decompiler in order to analyze archives" decompiler = ArchiveDecompiler(archive_decompiler_args) sys.exit(decompiler.decompile_archive())