From 32a89a1834980db112283016fffca0a41fc21365 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Mon, 10 Jun 2019 12:36:16 -0400 Subject: [PATCH] rename empy templates (*.template) to proper file extension (.em) --- msg/CMakeLists.txt | 4 ++-- .../px4/ros/{msg.h.template => msg.h.em} | 0 .../px4/uorb/{msg.h.template => msg.h.em} | 0 .../uorb/{msg.cpp.template => msg.cpp.em} | 0 .../uorb/{msg.h.template => msg.h.em} | 0 ...RBTopics.cpp.template => uORBTopics.cpp.em} | 0 ...nt.cpp.template => microRTPS_client.cpp.em} | 0 .../{msg.cpp.template => msg.cpp.em} | 0 .../uorb_microcdr/{msg.h.template => msg.h.em} | 0 ...RBTopics.cpp.template => uORBTopics.cpp.em} | 0 ...Publisher.cpp.template => Publisher.cpp.em} | 0 .../{Publisher.h.template => Publisher.h.em} | 0 ...psTopics.cpp.template => RtpsTopics.cpp.em} | 0 .../{RtpsTopics.h.template => RtpsTopics.h.em} | 0 ...bscriber.cpp.template => Subscriber.cpp.em} | 0 .../{Subscriber.h.template => Subscriber.h.em} | 0 ...ent.cpp.template => microRTPS_agent.cpp.em} | 0 ...plate => microRTPS_agent_CMakeLists.txt.em} | 0 .../urtps/{msg.idl.template => msg.idl.em} | 0 msg/tools/generate_microRTPS_bridge.py | 18 +++++++++--------- msg/tools/px_generate_uorb_topic_files.py | 16 ++++++++-------- msg/tools/px_generate_uorb_topic_helper.py | 2 +- src/lib/FlightTasks/CMakeLists.txt | 6 ++++-- ...p.template => FlightTasks_generated.cpp.em} | 0 ...p.template => FlightTasks_generated.hpp.em} | 0 src/lib/FlightTasks/generate_flight_tasks.py | 2 +- 26 files changed, 25 insertions(+), 23 deletions(-) rename msg/templates/px4/ros/{msg.h.template => msg.h.em} (100%) rename msg/templates/px4/uorb/{msg.h.template => msg.h.em} (100%) rename msg/templates/uorb/{msg.cpp.template => msg.cpp.em} (100%) rename msg/templates/uorb/{msg.h.template => msg.h.em} (100%) rename msg/templates/uorb/{uORBTopics.cpp.template => uORBTopics.cpp.em} (100%) rename msg/templates/uorb_microcdr/{microRTPS_client.cpp.template => microRTPS_client.cpp.em} (100%) rename msg/templates/uorb_microcdr/{msg.cpp.template => msg.cpp.em} (100%) rename msg/templates/uorb_microcdr/{msg.h.template => msg.h.em} (100%) rename msg/templates/uorb_microcdr/{uORBTopics.cpp.template => uORBTopics.cpp.em} (100%) rename msg/templates/urtps/{Publisher.cpp.template => Publisher.cpp.em} (100%) rename msg/templates/urtps/{Publisher.h.template => Publisher.h.em} (100%) rename msg/templates/urtps/{RtpsTopics.cpp.template => RtpsTopics.cpp.em} (100%) rename msg/templates/urtps/{RtpsTopics.h.template => RtpsTopics.h.em} (100%) rename msg/templates/urtps/{Subscriber.cpp.template => Subscriber.cpp.em} (100%) rename msg/templates/urtps/{Subscriber.h.template => Subscriber.h.em} (100%) rename msg/templates/urtps/{microRTPS_agent.cpp.template => microRTPS_agent.cpp.em} (100%) rename msg/templates/urtps/{microRTPS_agent_CMakeLists.txt.template => microRTPS_agent_CMakeLists.txt.em} (100%) rename msg/templates/urtps/{msg.idl.template => msg.idl.em} (100%) rename src/lib/FlightTasks/Templates/{FlightTasks_generated.cpp.template => FlightTasks_generated.cpp.em} (100%) rename src/lib/FlightTasks/Templates/{FlightTasks_generated.hpp.template => FlightTasks_generated.hpp.em} (100%) diff --git a/msg/CMakeLists.txt b/msg/CMakeLists.txt index fd871cb0df..986865d45b 100644 --- a/msg/CMakeLists.txt +++ b/msg/CMakeLists.txt @@ -184,7 +184,7 @@ add_custom_command(OUTPUT ${uorb_headers} -q DEPENDS ${msg_files} - templates/uorb/msg.h.template + templates/uorb/msg.h.em tools/px_generate_uorb_topic_files.py COMMENT "Generating uORB topic headers" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} @@ -204,7 +204,7 @@ add_custom_command(OUTPUT ${uorb_sources} -q DEPENDS ${msg_files} - templates/uorb/msg.cpp.template + templates/uorb/msg.cpp.em tools/px_generate_uorb_topic_files.py COMMENT "Generating uORB topic sources" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/msg/templates/px4/ros/msg.h.template b/msg/templates/px4/ros/msg.h.em similarity index 100% rename from msg/templates/px4/ros/msg.h.template rename to msg/templates/px4/ros/msg.h.em diff --git a/msg/templates/px4/uorb/msg.h.template b/msg/templates/px4/uorb/msg.h.em similarity index 100% rename from msg/templates/px4/uorb/msg.h.template rename to msg/templates/px4/uorb/msg.h.em diff --git a/msg/templates/uorb/msg.cpp.template b/msg/templates/uorb/msg.cpp.em similarity index 100% rename from msg/templates/uorb/msg.cpp.template rename to msg/templates/uorb/msg.cpp.em diff --git a/msg/templates/uorb/msg.h.template b/msg/templates/uorb/msg.h.em similarity index 100% rename from msg/templates/uorb/msg.h.template rename to msg/templates/uorb/msg.h.em diff --git a/msg/templates/uorb/uORBTopics.cpp.template b/msg/templates/uorb/uORBTopics.cpp.em similarity index 100% rename from msg/templates/uorb/uORBTopics.cpp.template rename to msg/templates/uorb/uORBTopics.cpp.em diff --git a/msg/templates/uorb_microcdr/microRTPS_client.cpp.template b/msg/templates/uorb_microcdr/microRTPS_client.cpp.em similarity index 100% rename from msg/templates/uorb_microcdr/microRTPS_client.cpp.template rename to msg/templates/uorb_microcdr/microRTPS_client.cpp.em diff --git a/msg/templates/uorb_microcdr/msg.cpp.template b/msg/templates/uorb_microcdr/msg.cpp.em similarity index 100% rename from msg/templates/uorb_microcdr/msg.cpp.template rename to msg/templates/uorb_microcdr/msg.cpp.em diff --git a/msg/templates/uorb_microcdr/msg.h.template b/msg/templates/uorb_microcdr/msg.h.em similarity index 100% rename from msg/templates/uorb_microcdr/msg.h.template rename to msg/templates/uorb_microcdr/msg.h.em diff --git a/msg/templates/uorb_microcdr/uORBTopics.cpp.template b/msg/templates/uorb_microcdr/uORBTopics.cpp.em similarity index 100% rename from msg/templates/uorb_microcdr/uORBTopics.cpp.template rename to msg/templates/uorb_microcdr/uORBTopics.cpp.em diff --git a/msg/templates/urtps/Publisher.cpp.template b/msg/templates/urtps/Publisher.cpp.em similarity index 100% rename from msg/templates/urtps/Publisher.cpp.template rename to msg/templates/urtps/Publisher.cpp.em diff --git a/msg/templates/urtps/Publisher.h.template b/msg/templates/urtps/Publisher.h.em similarity index 100% rename from msg/templates/urtps/Publisher.h.template rename to msg/templates/urtps/Publisher.h.em diff --git a/msg/templates/urtps/RtpsTopics.cpp.template b/msg/templates/urtps/RtpsTopics.cpp.em similarity index 100% rename from msg/templates/urtps/RtpsTopics.cpp.template rename to msg/templates/urtps/RtpsTopics.cpp.em diff --git a/msg/templates/urtps/RtpsTopics.h.template b/msg/templates/urtps/RtpsTopics.h.em similarity index 100% rename from msg/templates/urtps/RtpsTopics.h.template rename to msg/templates/urtps/RtpsTopics.h.em diff --git a/msg/templates/urtps/Subscriber.cpp.template b/msg/templates/urtps/Subscriber.cpp.em similarity index 100% rename from msg/templates/urtps/Subscriber.cpp.template rename to msg/templates/urtps/Subscriber.cpp.em diff --git a/msg/templates/urtps/Subscriber.h.template b/msg/templates/urtps/Subscriber.h.em similarity index 100% rename from msg/templates/urtps/Subscriber.h.template rename to msg/templates/urtps/Subscriber.h.em diff --git a/msg/templates/urtps/microRTPS_agent.cpp.template b/msg/templates/urtps/microRTPS_agent.cpp.em similarity index 100% rename from msg/templates/urtps/microRTPS_agent.cpp.template rename to msg/templates/urtps/microRTPS_agent.cpp.em diff --git a/msg/templates/urtps/microRTPS_agent_CMakeLists.txt.template b/msg/templates/urtps/microRTPS_agent_CMakeLists.txt.em similarity index 100% rename from msg/templates/urtps/microRTPS_agent_CMakeLists.txt.template rename to msg/templates/urtps/microRTPS_agent_CMakeLists.txt.em diff --git a/msg/templates/urtps/msg.idl.template b/msg/templates/urtps/msg.idl.em similarity index 100% rename from msg/templates/urtps/msg.idl.template rename to msg/templates/urtps/msg.idl.em diff --git a/msg/tools/generate_microRTPS_bridge.py b/msg/tools/generate_microRTPS_bridge.py index e6504b5009..61d0882d14 100644 --- a/msg/tools/generate_microRTPS_bridge.py +++ b/msg/tools/generate_microRTPS_bridge.py @@ -265,15 +265,15 @@ classifier = (Classifier(os.path.abspath(args.yaml_file), msg_dir) if os.path.is check_rtps_id_uniqueness(classifier) -uRTPS_CLIENT_TEMPL_FILE = 'microRTPS_client.cpp.template' -uRTPS_AGENT_TOPICS_H_TEMPL_FILE = 'RtpsTopics.h.template' -uRTPS_AGENT_TOPICS_SRC_TEMPL_FILE = 'RtpsTopics.cpp.template' -uRTPS_AGENT_TEMPL_FILE = 'microRTPS_agent.cpp.template' -uRTPS_AGENT_CMAKELISTS_TEMPL_FILE = 'microRTPS_agent_CMakeLists.txt.template' -uRTPS_PUBLISHER_SRC_TEMPL_FILE = 'Publisher.cpp.template' -uRTPS_PUBLISHER_H_TEMPL_FILE = 'Publisher.h.template' -uRTPS_SUBSCRIBER_SRC_TEMPL_FILE = 'Subscriber.cpp.template' -uRTPS_SUBSCRIBER_H_TEMPL_FILE = 'Subscriber.h.template' +uRTPS_CLIENT_TEMPL_FILE = 'microRTPS_client.cpp.em' +uRTPS_AGENT_TOPICS_H_TEMPL_FILE = 'RtpsTopics.h.em' +uRTPS_AGENT_TOPICS_SRC_TEMPL_FILE = 'RtpsTopics.cpp.em' +uRTPS_AGENT_TEMPL_FILE = 'microRTPS_agent.cpp.em' +uRTPS_AGENT_CMAKELISTS_TEMPL_FILE = 'microRTPS_agent_CMakeLists.txt.em' +uRTPS_PUBLISHER_SRC_TEMPL_FILE = 'Publisher.cpp.em' +uRTPS_PUBLISHER_H_TEMPL_FILE = 'Publisher.h.em' +uRTPS_SUBSCRIBER_SRC_TEMPL_FILE = 'Subscriber.cpp.em' +uRTPS_SUBSCRIBER_H_TEMPL_FILE = 'Subscriber.h.em' def generate_agent(out_dir): diff --git a/msg/tools/px_generate_uorb_topic_files.py b/msg/tools/px_generate_uorb_topic_files.py index 906a1dd196..8e3c8b3491 100755 --- a/msg/tools/px_generate_uorb_topic_files.py +++ b/msg/tools/px_generate_uorb_topic_files.py @@ -77,13 +77,13 @@ __license__ = "BSD" __email__ = "thomasgubler@gmail.com" -TEMPLATE_FILE = ['msg.h.template', 'msg.cpp.template'] -TOPICS_LIST_TEMPLATE_FILE = 'uORBTopics.cpp.template' +TEMPLATE_FILE = ['msg.h.em', 'msg.cpp.em'] +TOPICS_LIST_TEMPLATE_FILE = 'uORBTopics.cpp.em' OUTPUT_FILE_EXT = ['.h', '.cpp'] INCL_DEFAULT = ['std_msgs:./msg/std_msgs'] PACKAGE = 'px4' TOPICS_TOKEN = '# TOPICS ' -IDL_TEMPLATE_FILE = 'msg.idl.template' +IDL_TEMPLATE_FILE = 'msg.idl.em' class MsgScope: @@ -184,7 +184,7 @@ def generate_idl_file(filename_msg, outputdir, templatedir, package, includepath template_file = os.path.join(templatedir, IDL_TEMPLATE_FILE) output_file = os.path.join(outputdir, IDL_TEMPLATE_FILE.replace( - "msg.idl.template", str(spec_short_name + "_.idl"))) + "msg.idl.em", str(spec_short_name + "_.idl"))) return generate_by_template(output_file, template_file, em_globals) @@ -210,7 +210,7 @@ def generate_uRTPS_general(filename_send_msgs, filename_received_msgs, template_file = os.path.join(templatedir, template_name) output_file = os.path.join( - outputdir, template_name.replace(".template", "")) + outputdir, template_name.replace(".em", "")) return generate_by_template(output_file, template_file, merged_em_globals) @@ -229,7 +229,7 @@ def generate_topic_file(filename_msg, outputdir, templatedir, package, includepa template_file = os.path.join(templatedir, template_name) output_file = os.path.join( - outputdir, spec_short_name + "_" + template_name.replace(".template", "")) + outputdir, spec_short_name + "_" + template_name.replace(".em", "")) return generate_by_template(output_file, template_file, em_globals) @@ -411,7 +411,7 @@ def generate_topics_list_file(msgdir, outputdir, templatedir): tl_globals = {"msgs": msgs, "multi_topics": multi_topics} tl_template_file = os.path.join(templatedir, TOPICS_LIST_TEMPLATE_FILE) tl_out_file = os.path.join( - outputdir, TOPICS_LIST_TEMPLATE_FILE.replace(".template", "")) + outputdir, TOPICS_LIST_TEMPLATE_FILE.replace(".em", "")) generate_by_template(tl_out_file, tl_template_file, tl_globals) @@ -425,7 +425,7 @@ def generate_topics_list_file_from_files(files, outputdir, templatedir): tl_globals = {"msgs": filenames, "multi_topics": multi_topics} tl_template_file = os.path.join(templatedir, TOPICS_LIST_TEMPLATE_FILE) tl_out_file = os.path.join( - outputdir, TOPICS_LIST_TEMPLATE_FILE.replace(".template", "")) + outputdir, TOPICS_LIST_TEMPLATE_FILE.replace(".em", "")) generate_by_template(tl_out_file, tl_template_file, tl_globals) diff --git a/msg/tools/px_generate_uorb_topic_helper.py b/msg/tools/px_generate_uorb_topic_helper.py index 00a33432ce..196ab53c6e 100644 --- a/msg/tools/px_generate_uorb_topic_helper.py +++ b/msg/tools/px_generate_uorb_topic_helper.py @@ -33,7 +33,7 @@ ############################################################################# ''' -Helper methods & common code for the uorb message templates msg.{cpp,h}.template +Helper methods & common code for the uorb message templates msg.{cpp,h}.em Another positive effect of having the code here, is that this file will get precompiled and thus message generation will be much faster diff --git a/src/lib/FlightTasks/CMakeLists.txt b/src/lib/FlightTasks/CMakeLists.txt index eccc3ba4fb..fd64349513 100644 --- a/src/lib/FlightTasks/CMakeLists.txt +++ b/src/lib/FlightTasks/CMakeLists.txt @@ -93,9 +93,11 @@ add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/FlightTasks_generated.hpp ${CMAKE_CURRENT_BINARY_DIR}/FlightTasks_generated.cpp - COMMAND ${PYTHON_EXECUTABLE} generate_flight_tasks.py - ${python_args} + COMMAND ${PYTHON_EXECUTABLE} generate_flight_tasks.py ${python_args} COMMENT "Generating Flight Tasks" + DEPENDS + Templates/FlightTasks_generated.cpp.em + Templates/FlightTasks_generated.hpp.em WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} VERBATIM ) diff --git a/src/lib/FlightTasks/Templates/FlightTasks_generated.cpp.template b/src/lib/FlightTasks/Templates/FlightTasks_generated.cpp.em similarity index 100% rename from src/lib/FlightTasks/Templates/FlightTasks_generated.cpp.template rename to src/lib/FlightTasks/Templates/FlightTasks_generated.cpp.em diff --git a/src/lib/FlightTasks/Templates/FlightTasks_generated.hpp.template b/src/lib/FlightTasks/Templates/FlightTasks_generated.hpp.em similarity index 100% rename from src/lib/FlightTasks/Templates/FlightTasks_generated.hpp.template rename to src/lib/FlightTasks/Templates/FlightTasks_generated.hpp.em diff --git a/src/lib/FlightTasks/generate_flight_tasks.py b/src/lib/FlightTasks/generate_flight_tasks.py index 8f8ea7e732..9bbb192f0e 100644 --- a/src/lib/FlightTasks/generate_flight_tasks.py +++ b/src/lib/FlightTasks/generate_flight_tasks.py @@ -23,5 +23,5 @@ for gen_file in args.gen_files: "tasks_add": args.tasks_add, } interpreter = em.Interpreter(output=output_file, globals=em_globals) - interpreter.file(open(args.directory_in + "/" + gen_file + ".template")) + interpreter.file(open(args.directory_in + "/" + gen_file + ".em")) interpreter.shutdown()