From 90a107054112fecd156e2b7802d72f85c68be8d4 Mon Sep 17 00:00:00 2001 From: Rob Syme Date: Wed, 1 May 2024 14:08:22 -0400 Subject: [PATCH 1/4] Extend repo_full_name_from_remote function to accomodate paths that begin with ssh:// ftp[s]:// etc. --- nf_core/modules/modules_utils.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/nf_core/modules/modules_utils.py b/nf_core/modules/modules_utils.py index ca8993483b..21169516bd 100644 --- a/nf_core/modules/modules_utils.py +++ b/nf_core/modules/modules_utils.py @@ -20,22 +20,20 @@ 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] - return path + path = urlparse(remote_url).path + + # Remove the file extension from the path + path, _ = os.path.splitext(path) + return path def get_installed_modules(dir: str, repo_type="modules") -> Tuple[List[str], List[NFCoreComponent]]: """ From bb4992090d2c2a97c5ccec16ebd850d7b4a34d0f Mon Sep 17 00:00:00 2001 From: Rob Syme Date: Wed, 1 May 2024 14:17:26 -0400 Subject: [PATCH 2/4] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b618f947ba..0e38e319c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## v2.13.2dev +- Handle more complete list of possible git URL forms (ssh:// and ftp:// prefixes specifically) + ### Template - Remove fasta default from nextflow.config ([#2828](https://github.com/nf-core/tools/pull/2828)) From 453f9ea2b23d34780ef417e2ba4842e7f7b6e3d9 Mon Sep 17 00:00:00 2001 From: Rob Syme Date: Wed, 1 May 2024 14:24:06 -0400 Subject: [PATCH 3/4] Ruff formatting fix --- nf_core/modules/modules_utils.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nf_core/modules/modules_utils.py b/nf_core/modules/modules_utils.py index 21169516bd..6796de41ec 100644 --- a/nf_core/modules/modules_utils.py +++ b/nf_core/modules/modules_utils.py @@ -23,10 +23,10 @@ def repo_full_name_from_remote(remote_url: str) -> str: 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: + 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 + path = urlparse(remote_url.split("git@")[-1]).path else: path = urlparse(remote_url).path @@ -35,6 +35,7 @@ def repo_full_name_from_remote(remote_url: str) -> str: return path + def get_installed_modules(dir: str, repo_type="modules") -> Tuple[List[str], List[NFCoreComponent]]: """ Make a list of all modules installed in this repository From d0c17ca718c942c75c67bc7f08e0d61a97b11b57 Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Fri, 3 May 2024 10:39:53 +0000 Subject: [PATCH 4/4] [automated] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e38e319c0..6ee191a4b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,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]