Skip to content

Commit

Permalink
Upgrade minimum cmake version function (DLu#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
DLu authored Nov 12, 2020
1 parent 79684ba commit db6376e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 9 additions & 0 deletions ros_introspection/src/ros_introspection/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,15 @@ def enforce_ordering(self, default_style=None):
for group in self.content_map['group']:
group.sub.enforce_ordering(default_style)

def upgrade_minimum_version(self, new_version):
""" New version is a tuple """
for cmd in self.content_map['cmake_minimum_required']:
section = cmd.get_section('VERSION')
version = tuple(map(int, section.values[0].split('.')))
if version < new_version:
section.values[0] = '.'.join(map(str, new_version))
cmd.changed = True

def __repr__(self):
return ''.join(map(str, self.contents))

Expand Down
9 changes: 1 addition & 8 deletions roscompile/scripts/noetic_migration
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,13 @@ args = parser.parse_args()

pkgs = get_packages()

MIN_CMAKE_VERSION = (3, 0, 2)

# TODO(dlu): Replace Orocos KDL and BFL rosdep keys
# TODO(dlu): package_dir option for weird Python location


for package in pkgs:
# Upgrade CMake Version
for cmd in package.cmake.content_map['cmake_minimum_required']:
section = cmd.get_section('VERSION')
version = tuple(map(int, section.values[0].split('.')))
if version < MIN_CMAKE_VERSION:
section.values[0] = '.'.join(map(str, MIN_CMAKE_VERSION))
cmd.changed = True
package.cmake.upgrade_minimum_version(package.cmake, (3, 0, 2))

# Setuptools instead of Distutils
if package.setup_py and not package.setup_py.noetic:
Expand Down

0 comments on commit db6376e

Please sign in to comment.