Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Components: Handle extended set of git path prefixes #2945

Merged
merged 5 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## v2.13.2dev

- Handle more complete list of possible git URL forms (ssh:// and ftp:// prefixes specifically)

mirpedrol marked this conversation as resolved.
Show resolved Hide resolved
### Template

- Remove fasta default from nextflow.config ([#2828](https://github.com/nf-core/tools/pull/2828))
Expand Down Expand Up @@ -61,6 +63,7 @@
- Update gitpod/workspace-base Docker digest to 5aeb24f ([#2929](https://github.com/nf-core/tools/pull/2929))
- Update pre-commit hook pre-commit/mirrors-mypy to v1.10.0 ([#2933](https://github.com/nf-core/tools/pull/2933))
- Update GitHub Actions ([#2939](https://github.com/nf-core/tools/pull/2939))
- Components: Handle extended set of git path prefixes ([#2945](https://github.com/nf-core/tools/pull/2945))

## [v2.13.1 - Tin Puppy Patch](https://github.com/nf-core/tools/releases/tag/2.13) - [2024-02-29]

Expand Down
25 changes: 12 additions & 13 deletions nf_core/modules/modules_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,19 @@ def repo_full_name_from_remote(remote_url: str) -> str:
Extracts the path from the remote URL
See https://mirrors.edge.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS for the possible URL patterns
"""
# Check whether we have a https or ssh url
if remote_url.startswith("https"):
path = urlparse(remote_url).path
# Remove the intial '/'
path = path[1:]
# Remove extension
path = os.path.splitext(path)[0]

if remote_url.startswith(("https://", "http://", "ftps://", "ftp://", "ssh://")):
# Parse URL and remove the initial '/'
path = urlparse(remote_url).path.lstrip("/")
elif "git@" in remote_url:
# Extract the part after 'git@' and parse it
path = urlparse(remote_url.split("git@")[-1]).path
else:
# Remove the initial `git@``
split_path: list = remote_url.split("@")
path = split_path[-1] if len(split_path) > 1 else split_path[0]
path = urlparse(path).path
# Remove extension
path = os.path.splitext(path)[0]
path = urlparse(remote_url).path

# Remove the file extension from the path
path, _ = os.path.splitext(path)

return path


Expand Down