diff --git a/bloom/generators/common.py b/bloom/generators/common.py index 2bfabbed..09ba51d9 100644 --- a/bloom/generators/common.py +++ b/bloom/generators/common.py @@ -42,6 +42,7 @@ from bloom.rosdistro_api import get_distribution_type from bloom.rosdistro_api import get_index +from bloom.rosdistro_api import get_python_version from bloom.util import code from bloom.util import maybe_continue @@ -139,9 +140,24 @@ def package_conditional_context(ros_distro): else: error("Bloom cannot cope with distribution_type '{0}'".format( distribution_type), exit=True) + python_version = get_python_version(ros_distro) + if python_version is None: + error( + 'No python_version found in the rosdistro index. ' + 'The rosdistro index must include this key for bloom to work correctly.', + exit=True) + elif python_version == 2: + ros_python_version = '2' + elif python_version == 3: + ros_python_version = '3' + else: + error("Bloom cannot cope with python_version '{0}'".format( + python_version), exit=True) + return { 'ROS_VERSION': ros_version, 'ROS_DISTRO': ros_distro, + 'ROS_PYTHON_VERSION': ros_python_version, } diff --git a/bloom/rosdistro_api.py b/bloom/rosdistro_api.py index a88b8a9e..bab31576 100644 --- a/bloom/rosdistro_api.py +++ b/bloom/rosdistro_api.py @@ -137,6 +137,10 @@ def get_distribution_type(distro): return get_index().distributions[distro].get('distribution_type') +def get_python_version(distro): + return get_index().distributions[distro].get('python_version') + + def get_most_recent(thing_name, repository, reference_distro): reference_distro_type = get_distribution_type(reference_distro) distros_with_entry = {} diff --git a/setup.py b/setup.py index 0ce619c6..142f9472 100755 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ 'python-dateutil', 'PyYAML', 'rosdep >= 0.15.0', - 'rosdistro >= 0.7.0', + 'rosdistro >= 0.7.5', 'vcstools >= 0.1.22', ] diff --git a/stdeb.cfg b/stdeb.cfg index 461f7295..20749de5 100755 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,6 +1,6 @@ [DEFAULT] -Depends: python-yaml, python-empy, python-argparse, python-rosdep (>= 0.15.0), python-rosdistro (>= 0.7.0), python-vcstools (>= 0.1.22), python-setuptools, python-catkin-pkg (>= 0.4.3) -Depends3: python3-yaml, python3-empy, python3-rosdep (>= 0.15.0), python3-rosdistro (>= 0.7.0), python3-vcstools (>= 0.1.22), python3-setuptools, python3-catkin-pkg (>= 0.4.3) +Depends: python-yaml, python-empy, python-argparse, python-rosdep (>= 0.15.0), python-rosdistro (>= 0.7.5), python-vcstools (>= 0.1.22), python-setuptools, python-catkin-pkg (>= 0.4.3) +Depends3: python3-yaml, python3-empy, python3-rosdep (>= 0.15.0), python3-rosdistro (>= 0.7.5), python3-vcstools (>= 0.1.22), python3-setuptools, python3-catkin-pkg (>= 0.4.3) Conflicts: python3-bloom Conflicts3: python-bloom Copyright-File: LICENSE.txt