Tools - fix toml file read (#9277)

This commit is contained in:
PabstMirror 2023-07-21 14:53:49 -05:00 committed by GitHub
parent 31e1ad0cff
commit ad1f50304f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -1302,10 +1302,11 @@ See the make.cfg file for additional build options.
addonTomlPath = os.path.join(work_drive, prefix, module, "addon.toml") addonTomlPath = os.path.join(work_drive, prefix, module, "addon.toml")
if os.path.isfile(addonTomlPath): if os.path.isfile(addonTomlPath):
with open(addonTomlPath, "r") as f: 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") print_error("'preprocess = false' not supported")
raise 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$")): if os.path.isfile(os.path.join(work_drive, prefix, module, "$NOBIN$")):
print_green("$NOBIN$ Found. Proceeding with non-binarizing!") print_green("$NOBIN$ Found. Proceeding with non-binarizing!")

View File

@ -29,17 +29,19 @@ def get_files_to_process(basePath):
addonTomlPath = os.path.join(root, "addon.toml") addonTomlPath = os.path.join(root, "addon.toml")
if os.path.isfile(addonTomlPath): if os.path.isfile(addonTomlPath):
with open(addonTomlPath, "r") as f: 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") print("'preprocess = false' not supported")
raise raise
skipPreprocessing = "[preprocess]\nenabled = false" in f.read() skipPreprocessing = "[preprocess]\nenabled = false" in tomlFile
addonTomlPath = os.path.join(os.path.dirname(root), "addon.toml") addonTomlPath = os.path.join(os.path.dirname(root), "addon.toml")
if os.path.isfile(addonTomlPath): if os.path.isfile(addonTomlPath):
with open(addonTomlPath, "r") as f: 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") print("'preprocess = false' not supported")
raise raise
skipPreprocessing = "[preprocess]\nenabled = false" in f.read() skipPreprocessing = "[preprocess]\nenabled = false" in tomlFile
if file == "config.cpp" and skipPreprocessing: if file == "config.cpp" and skipPreprocessing:
continue # ignore configs with __has_include continue # ignore configs with __has_include
filePath = os.path.join(root, file) filePath = os.path.join(root, file)