From e0fa10459d1bed50f23bd30c84ee06f9b0f2d042 Mon Sep 17 00:00:00 2001 From: takasehideki Date: Thu, 10 Mar 2022 21:51:19 +0900 Subject: [PATCH] remove `mros2Dir` from arg of python scripts --- mros2_header_generator/header_generator.py | 7 +++---- mros2_header_generator/templates_generator.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/mros2_header_generator/header_generator.py b/mros2_header_generator/header_generator.py index ca793af..88f8d59 100644 --- a/mros2_header_generator/header_generator.py +++ b/mros2_header_generator/header_generator.py @@ -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('_')) @@ -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 }) @@ -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 }) diff --git a/mros2_header_generator/templates_generator.py b/mros2_header_generator/templates_generator.py index 517c864..90e9698 100644 --- a/mros2_header_generator/templates_generator.py +++ b/mros2_header_generator/templates_generator.py @@ -4,8 +4,7 @@ from jinja2 import Environment, FileSystemLoader arg = sys.argv -mros2Dir = arg[1] -app = arg[2] +app = arg[1] includeFiles = [] pubMsgTypes = [] @@ -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: