Skip to content

Commit

Permalink
Add template name as parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
aremazeilles committed Jan 20, 2020
1 parent 87ec1ee commit aa648cb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions package_generator/src/package_generator/package_xml_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,11 @@ def write_xml(self, filename):
file_handler.write("{}\n".format(item))
return True

def generate_xml_from_spec(self, filename):
def generate_xml_from_spec(self, template_name, filename):
"""Generate an xml file based on the template dictionary
Args:
template_name (str): name of the template of interest
filename (str): filename where xml skeleton is to be written
Returns:
Expand All @@ -477,6 +478,8 @@ def generate_xml_from_spec(self, filename):
xml_pack = ET.Element('package')
for item in self.spec_.dico_['package_attributes']:
xml_pack.set(item, '')
# todo should we add the attribute template to the config?
xml_pack.set("package", template_name)

xml_comp = ET.SubElement(xml_pack, "comp")
for item in self.spec_.dico_['component_attributes']:
Expand Down Expand Up @@ -665,7 +668,7 @@ def main_generate_xml():
print colored("Prb while setting the parser dictionary", "red")
return -1

package_parser.generate_xml_from_spec(package_spec)
package_parser.generate_xml_from_spec(os.path.basename(path_template), package_spec)

print colored("Bye bye", "green")
return 0

0 comments on commit aa648cb

Please sign in to comment.