From ad1f50304fc68ff5ee4c01bd68360e0478f778e6 Mon Sep 17 00:00:00 2001 From: PabstMirror Date: Fri, 21 Jul 2023 14:53:49 -0500 Subject: [PATCH] Tools - fix toml file read (#9277) --- tools/make.py | 5 +++-- tools/sqfvmChecker.py | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tools/make.py b/tools/make.py index 5ac2f0f367..1e03725e98 100644 --- a/tools/make.py +++ b/tools/make.py @@ -1302,10 +1302,11 @@ See the make.cfg file for additional build options. addonTomlPath = os.path.join(work_drive, prefix, module, "addon.toml") if os.path.isfile(addonTomlPath): with open(addonTomlPath, "r") as f: - if "preprocess = false" in f.read(): + tomlFile = f.read() + if "preprocess = false" in tomlFile: print_error("'preprocess = false' not supported") raise - skipPreprocessing = "[preprocess]\nenabled = false" in f.read() + skipPreprocessing = "[preprocess]\nenabled = false" in tomlFile if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")): print_green("$NOBIN$ Found. Proceeding with non-binarizing!") diff --git a/tools/sqfvmChecker.py b/tools/sqfvmChecker.py index 6a85c9e5db..444b6e9026 100644 --- a/tools/sqfvmChecker.py +++ b/tools/sqfvmChecker.py @@ -29,17 +29,19 @@ def get_files_to_process(basePath): addonTomlPath = os.path.join(root, "addon.toml") if os.path.isfile(addonTomlPath): with open(addonTomlPath, "r") as f: - if "preprocess = false" in f.read(): + tomlFile = f.read() + if "preprocess = false" in tomlFile: print("'preprocess = false' not supported") raise - skipPreprocessing = "[preprocess]\nenabled = false" in f.read() + skipPreprocessing = "[preprocess]\nenabled = false" in tomlFile addonTomlPath = os.path.join(os.path.dirname(root), "addon.toml") if os.path.isfile(addonTomlPath): with open(addonTomlPath, "r") as f: - if "preprocess = false" in f.read(): + tomlFile = f.read() + if "preprocess = false" in tomlFile: print("'preprocess = false' not supported") raise - skipPreprocessing = "[preprocess]\nenabled = false" in f.read() + skipPreprocessing = "[preprocess]\nenabled = false" in tomlFile if file == "config.cpp" and skipPreprocessing: continue # ignore configs with __has_include filePath = os.path.join(root, file)