Refactor: build_dir_xml() function

- rename for clarity
- remove unnecessary checks
This commit is contained in:
JKarasti 2024-09-23 22:12:40 +03:00 committed by jkarasti
parent 9035497da3
commit 4f97ed4177

View file

@ -52,15 +52,13 @@ def build_data(base_path, path_prefix, dir_id, dir_name):
return data
def build_dir_xml(root, data):
def build_directory_xml(root, data):
attrs = {}
if "id" in data:
attrs["Id"] = data["directory_id"]
if "name" in data:
attrs["Name"] = data["directory_name"]
el = ET.SubElement(root, "Directory", attrs)
directory_el = ET.SubElement(root, "Directory", attrs)
for subdata in data["dirs"]:
build_dir_xml(el, subdata)
build_directory_xml(directory_el, subdata)
def build_components_xml(root, data):
@ -213,7 +211,8 @@ def main():
Id="ProgramFilesFolder",
)
build_dir_xml(programfilesfolder_el, data)
# Generate the directory layout for the installed product
build_directory_xml(programfilesfolder_el, data)
applicationcomponents_el = ET.SubElement(
package_el, "ComponentGroup", Id="ApplicationComponents"