Skip to content

Commit

Permalink
Add ROS_PYTHON_VERSION to dependency conditionals. (#551)
Browse files Browse the repository at this point in the history
* Raise rosdistro requirement to include new index-v4 changes.

The python_version key is required to supply ROS_PYTHON_VERSION to
conditional dependencies.

* Add API method for retrieving the distribution's python version.

* Add ROS_PYTHON_VERSION to conditional context.

* Fix pep8 conformance.

* Explicitly note when the python_version key is missing.

This feature will cause interruptions for bloom users whose version 4
rosdistro indexes lack this field. But I think this is preferred to a
silent or even vocal acceptance of a possibly invalid release state due
to missing conditional variables.
  • Loading branch information
nuclearsandwich authored Oct 18, 2019
1 parent 3f517fe commit 97330d9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
16 changes: 16 additions & 0 deletions bloom/generators/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
}


Expand Down
4 changes: 4 additions & 0 deletions bloom/rosdistro_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {}
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'python-dateutil',
'PyYAML',
'rosdep >= 0.15.0',
'rosdistro >= 0.7.0',
'rosdistro >= 0.7.5',
'vcstools >= 0.1.22',
]

Expand Down
4 changes: 2 additions & 2 deletions stdeb.cfg
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 97330d9

Please sign in to comment.