diff --git a/setup.py b/setup.py index e7796e64..dbaf745e 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,9 @@ """Package setup for cross_compile.""" +import errno import os +from os import path from xml.etree import ElementTree @@ -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 + /build/. + 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='ros-contributions@amazon.com', - url='https://github.com/ros2/cross_compile', + author='ROS Tooling Working Group', + author_email='ros-tooling@googlegroups.com', + maintainer='ROS Tooling Working Group', + maintainer_email='ros-tooling@googlegroups.com', + 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'] @@ -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' @@ -60,5 +101,6 @@ def read_version_from_package_xml(): 'console_scripts': [ 'cross_compile = cross_compile.ros2_cross_compile:main' ] - } + }, + python_requires='>=3.5', )