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

@ -247,7 +247,7 @@ def find_depbo_tools():
for tool in requiredToolPaths: for tool in requiredToolPaths:
try: try:
k = mikero_windows_registry(tool) k = mikero_windows_registry(tool)
path = winreg.QueryValueEx(k, "exe")[0] path = winreg.QueryValueEx(k, "exe")[0]
except FileNotFoundError: except FileNotFoundError:
print_error("Could not find {}".format(tool)) print_error("Could not find {}".format(tool))
failed = True failed = True
@ -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.
""") """)
@ -1188,7 +1188,7 @@ See the make.cfg file for additional build options.
print_error("\nFailed to delete {}".format(os.path.join(obsolete_check_path,file))) print_error("\nFailed to delete {}".format(os.path.join(obsolete_check_path,file)))
pass pass
# Always cleanup old sqfc # Always cleanup old sqfc
for root, _dirs, files in os.walk(module_root_parent): for root, _dirs, files in os.walk(module_root_parent):
for file in files: for file in files:
if file.endswith(".sqfc"): if file.endswith(".sqfc"):
@ -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"]
@ -1465,7 +1468,7 @@ See the make.cfg file for additional build options.
if sqfc_compiling: if sqfc_compiling:
print_blue("\nCleaning up sqfc...") print_blue("\nCleaning up sqfc...")
# cleanup all old sqfc # cleanup all old sqfc
for root, _dirs, files in os.walk(module_root_parent): for root, _dirs, files in os.walk(module_root_parent):
for file in files: for file in files:
if file.endswith(".sqfc"): if file.endswith(".sqfc"):

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)