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 3 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
2 changes: 2 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
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
Loading