11# Copyright 2025 Open Source Robotics Foundation, Inc.
22# Licensed under the Apache License, Version 2.0
33
4+ import pathlib
45from colcon_cargo .package_identification .cargo import read_cargo_toml
56from colcon_core .package_identification import IgnoreLocationException
67from colcon_core .package_identification \
@@ -25,6 +26,7 @@ def __init__(self): # noqa: D107
2526 PackageIdentificationExtensionPoint .EXTENSION_POINT_VERSION ,
2627 '^1.0' )
2728 self .workspace_package_paths = set ()
29+ self .non_cargo_paths = set ()
2830
2931 def identify (self , metadata ): # noqa: D102
3032 if metadata .type is not None and metadata .type != 'cargo' :
@@ -43,13 +45,24 @@ def identify(self, metadata): # noqa: D102
4345 for pattern in content ['workspace' ].get ('members' , ())
4446 for member in metadata .path .glob (pattern )
4547 }
46- ws_members . difference_update (
48+ excluded_ws_members = {
4749 exclude
4850 for pattern in content ['workspace' ].get ('exclude' , ())
4951 for exclude in metadata .path .glob (pattern )
50- )
52+ }
53+ ws_members .difference_update (excluded_ws_members )
5154 self .workspace_package_paths .update (ws_members )
5255
56+ all_package_paths = {
57+ p .parent for p in pathlib .Path (metadata .path ).rglob ("package.xml" )
58+ }
59+
60+ self .non_cargo_paths .update (
61+ all_package_paths .difference (
62+ self .workspace_package_paths , excluded_ws_members
63+ )
64+ )
65+
5366 if 'package' not in content :
5467 # Prevent any further attempts to discover packages in this
5568 # directory and let the workspace dictate where to look for
0 commit comments