From 529f03c0bfae2d97b10455ac300abba31dbf6155 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Thu, 10 Oct 2019 14:29:47 -0400 Subject: [PATCH 1/5] Raise rosdistro requirement to include new index-v4 changes. The python_version key is required to supply ROS_PYTHON_VERSION to conditional dependencies. --- setup.py | 2 +- stdeb.cfg | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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 From 78aa1cd5979d89e14de645578ca89d11ba50fe73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Thu, 10 Oct 2019 15:20:52 -0400 Subject: [PATCH 2/5] Add API method for retrieving the distribution's python version. --- bloom/rosdistro_api.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bloom/rosdistro_api.py b/bloom/rosdistro_api.py index a88b8a9e..ad1142b3 100644 --- a/bloom/rosdistro_api.py +++ b/bloom/rosdistro_api.py @@ -136,6 +136,9 @@ def list_distributions(): 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) From fb19df8587b3be82ebc699d23972f147e13c2376 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Thu, 10 Oct 2019 15:21:20 -0400 Subject: [PATCH 3/5] Add ROS_PYTHON_VERSION to conditional context. --- bloom/generators/common.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bloom/generators/common.py b/bloom/generators/common.py index 2bfabbed..f107eefb 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,19 @@ 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 == 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, } From a3167c3906a76fba3d280654824d0afe5a288280 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Fri, 11 Oct 2019 13:37:46 -0400 Subject: [PATCH 4/5] Fix pep8 conformance. --- bloom/rosdistro_api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bloom/rosdistro_api.py b/bloom/rosdistro_api.py index ad1142b3..bab31576 100644 --- a/bloom/rosdistro_api.py +++ b/bloom/rosdistro_api.py @@ -136,6 +136,7 @@ def list_distributions(): 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') From 0f5652147dc3f30bed3c23fcba32657b9dc524e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Fri, 18 Oct 2019 10:25:20 -0700 Subject: [PATCH 5/5] 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. --- bloom/generators/common.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bloom/generators/common.py b/bloom/generators/common.py index f107eefb..09ba51d9 100644 --- a/bloom/generators/common.py +++ b/bloom/generators/common.py @@ -141,7 +141,12 @@ def package_conditional_context(ros_distro): error("Bloom cannot cope with distribution_type '{0}'".format( distribution_type), exit=True) python_version = get_python_version(ros_distro) - if python_version == 2: + 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'