From be62a5768c905ebe020af23266e6767f84c9d6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnaro=CC=88k?= Date: Mon, 23 May 2022 20:18:17 -0700 Subject: [PATCH 1/3] Add API method for getting all build_types regardless of conditions. This is more of a spike than anything. I'm not convinced this is the best way to go for this particular issue but it was the first thought that came to my head. Of possibly more concern is that this gets us past the "first hurdle" but I'm unclear why the simple version bump doesn't crash also. --- src/catkin_pkg/package.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/catkin_pkg/package.py b/src/catkin_pkg/package.py index 005f5e57..0371e138 100644 --- a/src/catkin_pkg/package.py +++ b/src/catkin_pkg/package.py @@ -166,6 +166,23 @@ def get_build_type(self): return build_type_exports[0] raise InvalidPackage('Only one element is permitted.', self.filename) + def get_build_types(self): + """ + Return values of export/build_type elements without conditional filtering, or ['catkin'] if unspecified. + + :returns: package build types + :rtype: List[str] + :raises: :exc:`InvalidPackage` + """ + # for backward compatibility a build type without an evaluated + # condition is still being considered (i.e. evaluated_condition is None) + build_type_exports = [ + e.content for e in self.exports + if e.tagname == 'build_type'] + if not build_type_exports: + return ['catkin'] + return build_type_exports + def has_invalid_metapackage_dependencies(self): """ Return True if this package has invalid dependencies for a metapackage. From 8871546990e5f9efec2a963f448f1c1ab55f6753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Wed, 25 May 2022 11:48:10 -0700 Subject: [PATCH 2/3] Remove copypasted comments, docs, and reformat. --- src/catkin_pkg/package.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/catkin_pkg/package.py b/src/catkin_pkg/package.py index 0371e138..6e50d989 100644 --- a/src/catkin_pkg/package.py +++ b/src/catkin_pkg/package.py @@ -172,13 +172,8 @@ def get_build_types(self): :returns: package build types :rtype: List[str] - :raises: :exc:`InvalidPackage` """ - # for backward compatibility a build type without an evaluated - # condition is still being considered (i.e. evaluated_condition is None) - build_type_exports = [ - e.content for e in self.exports - if e.tagname == 'build_type'] + build_type_exports = [e.content for e in self.exports if e.tagname == 'build_type'] if not build_type_exports: return ['catkin'] return build_type_exports From 310974a3c0b0167729405c21223c43400acd6374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven!=20Ragnar=C3=B6k?= Date: Wed, 25 May 2022 16:36:48 -0700 Subject: [PATCH 3/3] Rename function to indicate that conditions are not respected. --- src/catkin_pkg/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/catkin_pkg/package.py b/src/catkin_pkg/package.py index 6e50d989..2843c697 100644 --- a/src/catkin_pkg/package.py +++ b/src/catkin_pkg/package.py @@ -166,7 +166,7 @@ def get_build_type(self): return build_type_exports[0] raise InvalidPackage('Only one element is permitted.', self.filename) - def get_build_types(self): + def get_unconditional_build_types(self): """ Return values of export/build_type elements without conditional filtering, or ['catkin'] if unspecified.