Tools - HEMTT preprocess is now an object (#9275)

* hemtt: preprocess is now an object

* error on deprecated usage
This commit is contained in:
BrettMayson 2023-07-21 10:23:03 -06:00 committed by GitHub
parent efe1ecd4cd
commit 12bb5aced4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 10 deletions

View File

@ -1 +1,2 @@
preprocess = false [preprocess]
enabled = false

View File

@ -1 +1,2 @@
preprocess = false [preprocess]
enabled = false

View File

@ -877,7 +877,7 @@ Examples:
If a file called $NOBIN$ is found in the module directory, that module will not be binarized. If a file called $NOBIN$ is found in the module directory, that module will not be binarized.
If preprocess = false is set in the addon.toml, that module's config will not be binarized. If preprocess.enabled = false is set in the addon.toml, that module's config will not be binarized.
See the make.cfg file for additional build options. See the make.cfg file for additional build options.
""") """)
@ -1302,13 +1302,16 @@ 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:
skipPreprocessing = "preprocess = false" in f.read() #python 3.11 has real toml but this is fine for now if "preprocess = false" in f.read():
print_error("'preprocess = false' not supported")
raise
skipPreprocessing = "[preprocess]\nenabled = false" in f.read()
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!")
cmd = [makepboTool, "-P","-A","-X=*.backup", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"addons")] cmd = [makepboTool, "-P","-A","-X=*.backup", os.path.join(work_drive, prefix, module),os.path.join(module_root, release_dir, project,"addons")]
elif skipPreprocessing: elif skipPreprocessing:
print_green("addon.toml set [preprocess = false]. Proceeding with non-binerized config build!") print_green("addon.toml set [preprocess.enabled = false]. Proceeding with non-binerized config build!")
cmd = [pboproject, "-B", "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S", "+Noisy", "+Clean", "-Warnings", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] cmd = [pboproject, "-B", "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S", "+Noisy", "+Clean", "-Warnings", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"]
else: else:
cmd = [pboproject, "+B", "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S", "+Noisy", "+Clean", "-Warnings", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"] cmd = [pboproject, "+B", "-P", os.path.join(work_drive, prefix, module), "+Engine=Arma3", "-S", "+Noisy", "+Clean", "-Warnings", "+Mod="+os.path.join(module_root, release_dir, project), "-Key"]

View File

@ -29,11 +29,17 @@ 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:
skipPreprocessing = "preprocess = false" in f.read() if "preprocess = false" in f.read():
print("'preprocess = false' not supported")
raise
skipPreprocessing = "[preprocess]\nenabled = false" in f.read()
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:
skipPreprocessing = "preprocess = false" in f.read() if "preprocess = false" in f.read():
print("'preprocess = false' not supported")
raise
skipPreprocessing = "[preprocess]\nenabled = false" in f.read()
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)