Skip to content

Commit

Permalink
Simple workaround to avoid crash on workspace (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdussieux authored Apr 9, 2024
1 parent 6607ddb commit 2f1dc54
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion colcon_cargo/package_identification/cargo.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import toml

logger = colcon_logger.getChild(__name__)

WORKSPACE="WORKSPACE"

class CargoPackageIdentification(PackageIdentificationExtensionPoint):
"""Identify Cargo packages with `Cargo.toml` files."""
Expand All @@ -28,6 +28,8 @@ def identify(self, metadata): # noqa: D102
return

data = extract_data(cargo_toml)
if data == WORKSPACE:
return
if not data:
raise RuntimeError(
'Failed to extract Rust package information from "%s"'
Expand Down Expand Up @@ -55,6 +57,9 @@ def extract_data(cargo_toml):
% cargo_toml.absolute())
return

if 'workspace' in content.keys():
return WORKSPACE

# set the project name - fall back to use the directory name
data = {}
toml_name_attr = extract_project_name(content)
Expand Down

0 comments on commit 2f1dc54

Please sign in to comment.