Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
Improve setup.py metadata (#60)
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Moulard <[email protected]>
  • Loading branch information
Thomas Moulard authored Nov 11, 2019
1 parent 698e1d6 commit 29ae22f
Showing 1 changed file with 50 additions and 8 deletions.
58 changes: 50 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

"""Package setup for cross_compile."""

import errno
import os
from os import path

from xml.etree import ElementTree

Expand All @@ -25,22 +27,63 @@
package_name = 'cross_compile'


def build_package_directory_path():
"""
Return the directory containing the package code, following symbolic links.
When compiling this package with colcon, users can optionally pass
a --symlink-install flag which will create a symlink of setup.py into
<prefix>/build/<pkg>.
Using this function, a path will be returned containing not only setup.py,
and some subset of files for which a symlink exists, but the original
package directory.
"""
try:
return os.path.dirname(os.readlink(__file__))
except OSError as os_error:
if os_error.errno == errno.EINVAL:
return os.path.dirname(__file__)


def read_version_from_package_xml():
tree = ElementTree.parse('package.xml')
version = tree.find('version')
return version.text


this_directory = build_package_directory_path()
with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()

setup(
name=package_name,
version=read_version_from_package_xml(),
packages=find_packages(exclude=['test']),
maintainer='AWS RoboMaker',
maintainer_email='[email protected]',
url='https://github.com/ros2/cross_compile',
author='ROS Tooling Working Group',
author_email='[email protected]',
maintainer='ROS Tooling Working Group',
maintainer_email='[email protected]',
url='https://github.com/ros-tooling/cross_compile',
download_url='https://github.com/ros-tooling/cross_compile/releases',
keywords=['ROS'],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Topic :: Software Development',
],
description='A tool to cross-compile ROS 2 packages.',
long_description=long_description,
long_description_content_type='text/markdown',
license='Apache License, Version 2.0',
data_files=[
('share/' + package_name, ['package.xml']),
('share/ament_index/resource_index/packages', [os.path.join('resource', package_name)]),
(os.path.join('share', package_name), ['package.xml']),
('share/ament_index/resource_index/packages',
[os.path.join('resource', package_name)]),
],
package_data={
package_name: ['Dockerfile_workspace']
Expand All @@ -50,8 +93,6 @@ def read_version_from_package_xml():
'docker',
],
zip_safe=True,
description='A cross compilation tool for ROS 2 packages.',
license='Apache License, Version 2.0',
tests_require=[
'pytest',
'flake8'
Expand All @@ -60,5 +101,6 @@ def read_version_from_package_xml():
'console_scripts': [
'cross_compile = cross_compile.ros2_cross_compile:main'
]
}
},
python_requires='>=3.5',
)

0 comments on commit 29ae22f

Please sign in to comment.