microRTPS: use package.version to compare FastRTPS lib versions

This commit is contained in:
TSC21
2020-03-24 13:31:41 +00:00
committed by Nuno Marques
parent 1f4b2d1d53
commit 1ea5280299
9 changed files with 33 additions and 28 deletions
+3 -7
View File
@@ -227,13 +227,9 @@ if fastrtpsgen_include is not None and fastrtpsgen_include != '':
os.path.abspath(
args.fastrtpsgen_include) + " "
# get FastRTPS version (major.minor, since patch is not relevant at this stage)
fastrtps_version = ""
try:
fastrtps_version = float(subprocess.check_output(
"ldconfig -v | grep libfastrtps | tail -c 6", shell=True).decode("utf-8").strip()[-5:-2])
except ValueError:
print("No valid version found to FasRTPS. Make sure it is installed.")
# get FastRTPS version
fastrtps_version = subprocess.check_output(
"ldconfig -v | grep libfastrtps", shell=True).decode("utf-8").strip().split('so.')[-1]
# get ROS 2 version, if exists
ros2_distro = ""
+2 -1
View File
@@ -43,6 +43,7 @@ import shutil
import filecmp
import argparse
import sys
from packaging import version
try:
import em
@@ -187,7 +188,7 @@ def generate_idl_file(filename_msg, msg_dir, alias, outputdir, templatedir, pack
os.makedirs(outputdir)
template_file = os.path.join(templatedir, IDL_TEMPLATE_FILE)
if 1.5 <= fastrtps_version <= 1.7:
if version.parse(fastrtps_version) <= version.parse('1.7'):
output_file = os.path.join(outputdir, IDL_TEMPLATE_FILE.replace(
"msg.idl.em", str(spec_short_name + "_.idl")))
else: