Skip to content

Commit

Permalink
Merge pull request #3364 from mirpedrol/fix-3361-rocrate-contributors
Browse files Browse the repository at this point in the history
Properly parse the names form `manifest.contributors`
  • Loading branch information
mirpedrol authored Dec 20, 2024
2 parents 728a91c + 5ecf583 commit fe5c5ac
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

- Add missing p ([#3357](https://github.com/nf-core/tools/pull/3357))
- Use `manifest.contributors` names if available, otherwise default to `manifest.author` ([#3362](https://github.com/nf-core/tools/pull/3362))
- Properly parse the names form `manifest.contributors` ([#3364](https://github.com/nf-core/tools/pull/3364))

### Version updates

Expand Down
14 changes: 5 additions & 9 deletions nf_core/pipelines/rocrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,20 +270,16 @@ def add_main_authors(self, wf_file: rocrate.model.entity.Entity) -> None:
authors = []
if "manifest.author" in self.pipeline_obj.nf_config:
authors.extend([a.strip() for a in self.pipeline_obj.nf_config["manifest.author"].split(",")])
if "manifest.contributor" in self.pipeline_obj.nf_config:
authors.extend(
[
c.get("name", "").strip()
for c in self.pipeline_obj.nf_config["manifest.contributor"]
if "name" in c
]
)
if "manifest.contributors" in self.pipeline_obj.nf_config:
contributors = self.pipeline_obj.nf_config["manifest.contributors"]
names = re.findall(r"name:'([^']+)'", contributors)
authors.extend(names)
if not authors:
raise KeyError("No authors found")
# add manifest authors as maintainer to crate

except KeyError:
log.error("No author or contributor fields found in manifest of nextflow.config")
log.error("No author or contributors fields found in manifest of nextflow.config")
return
# remove duplicates
authors = list(set(authors))
Expand Down

0 comments on commit fe5c5ac

Please sign in to comment.