Skip to content

Commit

Permalink
Set ROS_VERSION environment vairable
Browse files Browse the repository at this point in the history
  • Loading branch information
Taka-Kazu committed Jan 26, 2024
1 parent 1f9df9f commit a899945
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions generate_rospkg_apkbuild/genapkbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,25 @@ def package_to_apkbuild(ros_distro, package_name,
if date is not None:
ver_suffix = '_git' + date

pkg.evaluate_conditions(os.environ)

ros2_distros = [
name for name, value in get_index(get_index_url()).distributions.items()
if value.get("distribution_type") == "ros2"]
is_ros2 = ros_distro in ros2_distros

# Make ROS_VERSION available in package.xml
orig_ros_version_env = os.environ.get("ROS_VERSION")
if is_ros2:
os.environ["ROS_VERSION"] = "2"
else:
os.environ["ROS_VERSION"] = "1"

pkg.evaluate_conditions(os.environ)

if orig_ros_version_env:
os.environ["ROS_VERSION"] = orig_ros_version_env
else:
del os.environ["ROS_VERSION"]

depends = []
for dep in pkg.exec_depends:
depends.append(ros_dependency_to_name_ver(dep))
Expand Down

0 comments on commit a899945

Please sign in to comment.