Skip to content

Commit

Permalink
remove mros2Dir from arg of python scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
takasehideki committed Mar 10, 2022
1 parent 6a27021 commit e0fa104
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions mros2_header_generator/header_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
from jinja2 import Environment, FileSystemLoader

arg = sys.argv
mros2Dir = arg[1]
msgFile= arg[2]
msgFile = arg[1]

def toCamelCase(string):
return ''.join(x.capitalize() for x in string.split('_'))
Expand All @@ -22,7 +21,7 @@ def main():

# generate header file for mros2
for msg in msgs:
env = Environment(loader=FileSystemLoader(mros2Dir + '/mros2_header_generator'))
env = Environment(loader=FileSystemLoader('../mros2/mros2_header_generator'))
template = env.get_template('header_template.tpl')
datatext = template.render({ "msg": msg })

Expand All @@ -43,7 +42,7 @@ def genDepMsgHeader(genMsg):
msgs=[]
msgs.append(msgDataGenerator(genMsg.strip()))
for msg in msgs:
env = Environment(loader=FileSystemLoader(mros2Dir + '/mros2_header_generator'))
env = Environment(loader=FileSystemLoader('../mros2/mros2_header_generator'))
template = env.get_template('header_template.tpl')
datatext = template.render({ "msg": msg })

Expand Down
7 changes: 3 additions & 4 deletions mros2_header_generator/templates_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from jinja2 import Environment, FileSystemLoader

arg = sys.argv
mros2Dir = arg[1]
app = arg[2]
app = arg[1]

includeFiles = []
pubMsgTypes = []
Expand Down Expand Up @@ -39,13 +38,13 @@ def main():
includeFiles.append(includeFile)


env = Environment(loader=FileSystemLoader(mros2Dir + '/mros2_header_generator'))
env = Environment(loader=FileSystemLoader('../mros2/mros2_header_generator'))
template = env.get_template('templates.tpl')
datatext = template.render({ "includeFiles":includeFiles, "pubMsgTypes":pubMsgTypes, "subMsgTypes":subMsgTypes })
with open(os.path.join(app+"/templates.hpp"), "wb") as f:
f.write(datatext.encode('utf-8'))

env = Environment(loader=FileSystemLoader(mros2Dir + '/mros2_header_generator'))
env = Environment(loader=FileSystemLoader('../mros2/mros2_header_generator'))
template = env.get_template('header_includer.tpl')
datatext = template.render({ "app": app })
with open(os.path.join("../header_includer/header_includer.hpp"), "wb") as f:
Expand Down

0 comments on commit e0fa104

Please sign in to comment.