Skip to content

Frederic98/ros2_setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ros2Setup

This project is a tiny python library made for ROS2 modules to simplify the packaging process.
Instead of having two files -setup.py and package.xml- with the same duplicated information, this module makes it easy dynamically import the information from the package.xml into the python setup file.

This way, only the package.xml file has to be edited, to prevent having the two files with conflicting information.

Installing

Either install with pip install ros2setup, or copy ros2setup.py next to your setup.py so that it is accessible from there.

Usage

In the setup.py file of your ROS2 package, change the hardcoded information to a call to Ros2Setup to pull the data from the XML file.

from setuptools import setup
from ros2setup import Ros2Setup

package_name = Ros2Setup.tag('name')
setup(
    name=package_name,
    version=Ros2Setup.tag('version'),
    packages=[package_name],
    data_files=[
        ('share/ament_index/resource_index/packages',
            ['resource/' + package_name]),
        ('share/' + package_name, ['package.xml']),
    ],
    install_requires=['setuptools'],
    zip_safe=True,
    maintainer=Ros2Setup.tag('maintainer'),
    maintainer_email=Ros2Setup.attrib('maintainer', 'email'),
    description=Ros2Setup.tag('description'),
    license=Ros2Setup.tag('license'),
    tests_require=['pytest'],
    entry_points={
        'console_scripts': [
            'streamer = mypackage.submodule:main',
        ],
    },
)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages