Skip to content

Commit

Permalink
Add 'origin' metadata to cmake dependencies (#131)
Browse files Browse the repository at this point in the history
While I don't think we should discriminate between dependency origins for
general use, this is useful metadata in some contexts and is easy to
include.
  • Loading branch information
cottsay authored Oct 4, 2023
1 parent 76f5bf2 commit a2a4ce1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions colcon_cmake/package_identification/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import re
import sys

from colcon_core.dependency_descriptor import DependencyDescriptor
from colcon_core.logging import colcon_logger
from colcon_core.package_identification \
import PackageIdentificationExtensionPoint
Expand Down Expand Up @@ -187,9 +188,15 @@ def extract_dependencies(content):
:returns: The dependencies name
:rtype: list
"""
return \
extract_find_package_calls(content) | \
metadata = {
'origin': 'cmake',
}

return {
DependencyDescriptor(d, metadata=metadata)
for d in extract_find_package_calls(content) |
_extract_pkg_config_calls(content)
}


def extract_find_package_calls(content, *, function_name='find_package'):
Expand Down

0 comments on commit a2a4ce1

Please sign in to comment.