Skip to content

Commit 97330d9

Browse files
Add ROS_PYTHON_VERSION to dependency conditionals. (#551)
* 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.
1 parent 3f517fe commit 97330d9

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

bloom/generators/common.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
from bloom.rosdistro_api import get_distribution_type
4444
from bloom.rosdistro_api import get_index
45+
from bloom.rosdistro_api import get_python_version
4546

4647
from bloom.util import code
4748
from bloom.util import maybe_continue
@@ -139,9 +140,24 @@ def package_conditional_context(ros_distro):
139140
else:
140141
error("Bloom cannot cope with distribution_type '{0}'".format(
141142
distribution_type), exit=True)
143+
python_version = get_python_version(ros_distro)
144+
if python_version is None:
145+
error(
146+
'No python_version found in the rosdistro index. '
147+
'The rosdistro index must include this key for bloom to work correctly.',
148+
exit=True)
149+
elif python_version == 2:
150+
ros_python_version = '2'
151+
elif python_version == 3:
152+
ros_python_version = '3'
153+
else:
154+
error("Bloom cannot cope with python_version '{0}'".format(
155+
python_version), exit=True)
156+
142157
return {
143158
'ROS_VERSION': ros_version,
144159
'ROS_DISTRO': ros_distro,
160+
'ROS_PYTHON_VERSION': ros_python_version,
145161
}
146162

147163

bloom/rosdistro_api.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,10 @@ def get_distribution_type(distro):
137137
return get_index().distributions[distro].get('distribution_type')
138138

139139

140+
def get_python_version(distro):
141+
return get_index().distributions[distro].get('python_version')
142+
143+
140144
def get_most_recent(thing_name, repository, reference_distro):
141145
reference_distro_type = get_distribution_type(reference_distro)
142146
distros_with_entry = {}

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
'python-dateutil',
1111
'PyYAML',
1212
'rosdep >= 0.15.0',
13-
'rosdistro >= 0.7.0',
13+
'rosdistro >= 0.7.5',
1414
'vcstools >= 0.1.22',
1515
]
1616

stdeb.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[DEFAULT]
2-
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)
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)
2+
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)
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)
44
Conflicts: python3-bloom
55
Conflicts3: python-bloom
66
Copyright-File: LICENSE.txt

0 commit comments

Comments
 (0)