Skip to content

Commit fdea0ab

Browse files
committed
convert: add dependency as mainEntity if it is the only one
1 parent 3cde905 commit fdea0ab

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/runcrate/convert.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,8 @@ def add_tool(self, crate, workflow, cwl_tool):
419419
tool = crate.add(ContextEntity(crate, tool_id, properties=properties))
420420
if deps:
421421
tool["softwareRequirements"] = deps
422+
if len(deps) == 1:
423+
tool["mainEntity"] = deps[0]
422424
tool["input"] = self.add_params(crate, cwl_tool.inputs)
423425
tool["output"] = self.add_params(crate, cwl_tool.outputs)
424426
workflow.append_to("hasPart", tool)

tests/test_cwlprov_crate_builder.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ def test_dir_io(data_dir, tmpdir):
346346
assert grep.type == "SoftwareApplication"
347347
assert grep["name"] == "grep"
348348
assert grep["softwareVersion"] == ["3.8"]
349+
assert greptool["mainEntity"] is grep
349350
inputs = workflow["input"]
350351
outputs = workflow["output"]
351352
assert len(inputs) == 2

0 commit comments

Comments
 (0)