From e37eade0374726dd58b172f560d4d1ee11676674 Mon Sep 17 00:00:00 2001 From: Ruben Arts Date: Tue, 30 Sep 2025 13:20:44 +0200 Subject: [PATCH 1/3] refactor: default to `ros--` prefixed names. --- .../src/pixi_build_ros/utils.py | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/backends/pixi-build-ros/src/pixi_build_ros/utils.py b/backends/pixi-build-ros/src/pixi_build_ros/utils.py index 005dfbea..4de92373 100644 --- a/backends/pixi-build-ros/src/pixi_build_ros/utils.py +++ b/backends/pixi-build-ros/src/pixi_build_ros/utils.py @@ -102,23 +102,9 @@ def rosdep_to_conda_package_name( else: raise RuntimeError(f"Unsupported platform: {host_platform}") - # If dependency any of the following return custom name: - if dep_name in [ - "ament_cmake", - "ament_python", - "rosidl_default_generators", - "ros_workspace", - ]: - return [f"ros-{distro.name}-{dep_name.replace('_', '-')}"] - if dep_name not in package_map_data: - # If the dependency is not found in robostack.yaml, check the actual distro whether it exists - if distro.has_package(dep_name): - # This means that it is a ROS package, so we are going to assume has the `ros--` format. - return [f"ros-{distro.name}-{dep_name.replace('_', '-')}{spec_str}"] - else: - # If the dependency is not found in robostack.yaml and not in the distro, return the dependency name as is. - return [f"{dep_name}{spec_str}"] + # Package name isn't found in the package map, so we are going to assume it is a ROS package. + return [f"ros-{distro.name}-{dep_name.replace('_', '-')}{spec_str or ''}"] # Dependency found in package map @@ -226,7 +212,6 @@ def package_xml_to_conda_requirements( package_map_data: dict[str, PackageMapEntry], ) -> ConditionalRequirements: """Convert a CatkinPackage to ConditionalRequirements for conda.""" - # All build related dependencies go into the build requirements build_deps = pkg.buildtool_depends # TODO: should the export dependencies be included here? @@ -270,5 +255,7 @@ def package_xml_to_conda_requirements( cond.host = build_requirements cond.build = build_requirements cond.run = run_requirements + if "navigator" == pkg.name: + raise Exception(cond) return cond From 08e7c57b85c0180507e6181b625bfe3d3ab87fb2 Mon Sep 17 00:00:00 2001 From: Ruben Arts Date: Tue, 30 Sep 2025 13:31:11 +0200 Subject: [PATCH 2/3] test: get ros-distro prefix in tests and make them platform independent --- .../tests/__snapshots__/test_package_xml.ambr | 6 +++--- .../test_version_constraints.ambr | 18 +++++++++--------- .../pixi-build-ros/tests/test_package_xml.py | 2 +- .../tests/test_version_constraints.py | 6 +++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/backends/pixi-build-ros/tests/__snapshots__/test_package_xml.ambr b/backends/pixi-build-ros/tests/__snapshots__/test_package_xml.ambr index 78db7118..44aabb54 100644 --- a/backends/pixi-build-ros/tests/__snapshots__/test_package_xml.ambr +++ b/backends/pixi-build-ros/tests/__snapshots__/test_package_xml.ambr @@ -15,7 +15,7 @@ requirements: build: - ros-noetic-catkin - - ros_package + - ros-noetic-ros-package - ninja - python - setuptools @@ -30,7 +30,7 @@ - ${{ compiler('cxx') }} host: - ros-noetic-catkin - - ros_package + - ros-noetic-ros-package - python - numpy - pip @@ -38,7 +38,7 @@ - ros-distro-mutex run: - rich >=10.0 - - ros_package + - ros-noetic-ros-package - ros-distro-mutex run_constraints: [] tests: [] diff --git a/backends/pixi-build-ros/tests/__snapshots__/test_version_constraints.ambr b/backends/pixi-build-ros/tests/__snapshots__/test_version_constraints.ambr index 22b4b24c..1f182c1b 100644 --- a/backends/pixi-build-ros/tests/__snapshots__/test_version_constraints.ambr +++ b/backends/pixi-build-ros/tests/__snapshots__/test_version_constraints.ambr @@ -21,7 +21,7 @@ - xorg-libxext - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio <10.0.0 @@ -45,7 +45,7 @@ - xorg-libxext - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio <10.0.0 @@ -58,7 +58,7 @@ - rich >=10.0 - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio <10.0.0 @@ -99,7 +99,7 @@ - xorg-libxext - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio <10.0.0 @@ -123,7 +123,7 @@ - xorg-libxext - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio <10.0.0 @@ -135,7 +135,7 @@ run: - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio <10.0.0 @@ -176,7 +176,7 @@ - xorg-libxext - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio <10.0.0 @@ -200,7 +200,7 @@ - xorg-libxext - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio <10.0.0 @@ -212,7 +212,7 @@ run: - ros-noetic-ros-package <=2.0.0 - ros-noetic-ros-package-msgs <=2.0.0 - - ros_package2 <2.0.0a0 + - ros-noetic-ros-package2 <2.0.0a0 - qt-main >=5.15.0,<5.16.0 - tinyxml2 ==10.0.0 - asio >=9.0,<10.0.0,<10.0.0,<10.0.0 diff --git a/backends/pixi-build-ros/tests/test_package_xml.py b/backends/pixi-build-ros/tests/test_package_xml.py index a7ea35da..85e424ce 100644 --- a/backends/pixi-build-ros/tests/test_package_xml.py +++ b/backends/pixi-build-ros/tests/test_package_xml.py @@ -174,7 +174,7 @@ def test_recipe_includes_project_run_dependency(package_xmls: Path, distro: Dist model = ProjectModelV1.from_json(json.dumps(model_payload)) config = {"distro": "noetic", "noarch": False} - host_platform = Platform.current() + host_platform = Platform("linux-64") generator = ROSGenerator() generated_recipe = generator.generate_recipe( diff --git a/backends/pixi-build-ros/tests/test_version_constraints.py b/backends/pixi-build-ros/tests/test_version_constraints.py index c6ae5d42..02be12d6 100644 --- a/backends/pixi-build-ros/tests/test_version_constraints.py +++ b/backends/pixi-build-ros/tests/test_version_constraints.py @@ -31,7 +31,7 @@ def test_generate_recipe_with_versions(package_xmls: Path, test_data_dir: Path, } # Create host platform - host_platform = Platform.current() + host_platform = Platform("linux-64") # Create ROSGenerator instance generator = ROSGenerator() @@ -85,7 +85,7 @@ def test_generate_recipe_with_mutex_version(package_xmls: Path, test_data_dir: P model = ProjectModelV1.from_dict(model_payload) # Create host platform - host_platform = Platform.current() + host_platform = Platform("linux-64") # Create ROSGenerator instance generator = ROSGenerator() @@ -141,7 +141,7 @@ def test_generate_recipe_with_versions_in_model_and_package( model = ProjectModelV1.from_dict(model_payload) # Create host platform - host_platform = Platform.current() + host_platform = Platform("linux-64") # Create ROSGenerator instance generator = ROSGenerator() From f9755ecadacd5f11d55a3bc594e465ac1f3538f9 Mon Sep 17 00:00:00 2001 From: Ruben Arts Date: Tue, 30 Sep 2025 13:35:12 +0200 Subject: [PATCH 3/3] test: multi package non ros support --- .../pixi-build-ros/tests/__snapshots__/test_package_xml.ambr | 3 +++ backends/pixi-build-ros/tests/data/other_package_map.yaml | 2 ++ backends/pixi-build-ros/tests/data/package_xmls/custom_ros.xml | 1 + backends/pixi-build-ros/tests/test_package_map.py | 2 ++ 4 files changed, 8 insertions(+) diff --git a/backends/pixi-build-ros/tests/__snapshots__/test_package_xml.ambr b/backends/pixi-build-ros/tests/__snapshots__/test_package_xml.ambr index 44aabb54..4ba03660 100644 --- a/backends/pixi-build-ros/tests/__snapshots__/test_package_xml.ambr +++ b/backends/pixi-build-ros/tests/__snapshots__/test_package_xml.ambr @@ -16,6 +16,7 @@ build: - ros-noetic-catkin - ros-noetic-ros-package + - ros-noetic-multi-package - ninja - python - setuptools @@ -31,6 +32,7 @@ host: - ros-noetic-catkin - ros-noetic-ros-package + - ros-noetic-multi-package - python - numpy - pip @@ -39,6 +41,7 @@ run: - rich >=10.0 - ros-noetic-ros-package + - ros-noetic-multi-package - ros-distro-mutex run_constraints: [] tests: [] diff --git a/backends/pixi-build-ros/tests/data/other_package_map.yaml b/backends/pixi-build-ros/tests/data/other_package_map.yaml index 550837da..3ddbfb9b 100644 --- a/backends/pixi-build-ros/tests/data/other_package_map.yaml +++ b/backends/pixi-build-ros/tests/data/other_package_map.yaml @@ -2,5 +2,7 @@ alsa-oss: conda: [other-alsa-oss] new_package: conda: [new-package] +multi_package: + conda: [multi-package-a, multi-package-b] ros_package: ros: [ros_package, ros_package_msgs] diff --git a/backends/pixi-build-ros/tests/data/package_xmls/custom_ros.xml b/backends/pixi-build-ros/tests/data/package_xmls/custom_ros.xml index dfea1df2..db9edc11 100644 --- a/backends/pixi-build-ros/tests/data/package_xmls/custom_ros.xml +++ b/backends/pixi-build-ros/tests/data/package_xmls/custom_ros.xml @@ -14,6 +14,7 @@ Apache License 2.0 catkin ros_package + multi_package diff --git a/backends/pixi-build-ros/tests/test_package_map.py b/backends/pixi-build-ros/tests/test_package_map.py index 3e83af84..c2de09cf 100644 --- a/backends/pixi-build-ros/tests/test_package_map.py +++ b/backends/pixi-build-ros/tests/test_package_map.py @@ -92,6 +92,8 @@ def test_generate_recipe_with_custom_ros(package_xmls: Path, test_data_dir: Path req_string = list(str(req) for req in generated_recipe.recipe.requirements.run) assert "ros-noetic-ros-package" in req_string assert "ros-noetic-ros-package-msgs" in req_string + assert "multi-package-a" in req_string + assert "multi-package-b" in req_string def test_generate_recipe_with_inline_package_mappings(package_xmls: Path, test_data_dir: Path, distro_noetic: Distro):