Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 4 additions & 17 deletions backends/pixi-build-ros/src/pixi_build_ros/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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-<distro>-<dep_name>` 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

Expand Down Expand Up @@ -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?
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
requirements:
build:
- ros-noetic-catkin
- ros_package
- ros-noetic-ros-package
- ros-noetic-multi-package
- ninja
- python
- setuptools
Expand All @@ -30,15 +31,17 @@
- ${{ compiler('cxx') }}
host:
- ros-noetic-catkin
- ros_package
- ros-noetic-ros-package
- ros-noetic-multi-package
- python
- numpy
- pip
- pkg-config
- ros-distro-mutex
run:
- rich >=10.0
- ros_package
- ros-noetic-ros-package
- ros-noetic-multi-package
- ros-distro-mutex
run_constraints: []
tests: []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions backends/pixi-build-ros/tests/data/other_package_map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<license>Apache License 2.0</license>
<buildtool_depend>catkin</buildtool_depend>
<depend>ros_package</depend>
<depend>multi_package</depend>
<export>
</export>
</package>
2 changes: 2 additions & 0 deletions backends/pixi-build-ros/tests/test_package_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion backends/pixi-build-ros/tests/test_package_xml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions backends/pixi-build-ros/tests/test_version_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand Down
Loading