colcon-common-extensions: ROS 2 Build Tool Bundle

0.3.0 · active · verified Fri Apr 17

colcon-common-extensions is a meta-package that aggregates `colcon-core` and several common `colcon` extensions, providing a comprehensive build system for ROS 2 and other robotics projects. It does not provide functionality itself, but ensures a consistent set of `colcon` features are installed. The current version is 0.3.0, and it follows the release cadence of its underlying `colcon-*` dependencies, often aligning with ROS 2 distribution releases.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to verify the installation of the 'colcon' command-line tool, which is enabled by `colcon-common-extensions`. It executes `colcon --version` using `subprocess` to confirm that the tool is accessible and functional within a Python environment.

import subprocess
import sys

# colcon-common-extensions itself is a meta-package and doesn't expose
# direct Python APIs for user applications. Its primary utility is installing
# the 'colcon' command-line tool and its extensions.
# This quickstart verifies the 'colcon' command is available and functional.

try:
    # Using '-m colcon_core.cli' to run colcon as a module is generally more robust
    # than 'colcon' directly, especially in isolated Python environments.
    result = subprocess.run(
        [sys.executable, "-m", "colcon_core.cli", "--version"],
        capture_output=True,
        text=True,
        check=True
    )
    print(f"colcon command is available. Version:\n{result.stdout.strip()}")
    print("colcon command is functional.")
except FileNotFoundError:
    print("Error: 'colcon' executable not found. Ensure colcon-common-extensions is installed and in PATH.")
    sys.exit(1)
except subprocess.CalledProcessError as e:
    print(f"Error running colcon: {e}")
    print(f"Stdout: {e.stdout}")
    print(f"Stderr: {e.stderr}")
    sys.exit(1)

view raw JSON →