mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 03:43:34 +08:00
microRTPS: use package.version to compare FastRTPS lib versions
This commit is contained in:
@@ -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 = ""
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user