Skip to content

Commit

Permalink
refact: Use modulesrepo for current_repo in install
Browse files Browse the repository at this point in the history
  • Loading branch information
jvfe committed Dec 16, 2024
1 parent a40c07c commit f4cc0fe
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions nf_core/components/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
installed_by: Optional[List[str]] = None,
):
super().__init__(component_type, pipeline_dir, remote_url, branch, no_pull)
self.current_remote = remote_url
self.current_remote = ModulesRepo(remote_url, branch)
self.branch = branch
self.force = force
self.prompt = prompt
Expand All @@ -53,15 +53,15 @@ def __init__(
def install(self, component: Union[str, Dict[str, str]], silent: bool = False) -> bool:
if isinstance(component, dict):
# Override modules_repo when the component to install is a dependency from a subworkflow.
remote_url = component.get("git_remote", self.current_remote)
remote_url = component.get("git_remote", self.current_remote.remote_url)
branch = component.get("branch", self.branch)
self.modules_repo = ModulesRepo(remote_url, branch)
component = component["name"]

if self.current_remote is None:
self.current_remote = self.modules_repo.remote_url
self.current_remote = self.modules_repo

if self.current_remote == self.modules_repo.remote_url and self.sha is not None:
if self.current_remote.remote_url == self.modules_repo.remote_url and self.sha is not None:
self.current_sha = self.sha
else:
self.current_sha = None
Expand Down Expand Up @@ -244,7 +244,7 @@ def collect_and_verify_name(

raise ValueError

if self.current_remote == modules_repo.remote_url:
if self.current_remote.remote_url == modules_repo.remote_url:
if not modules_repo.component_exists(component, self.component_type, commit=self.current_sha):
warn_msg = f"{self.component_type[:-1].title()} '{component}' not found in remote '{modules_repo.remote_url}' ({modules_repo.branch})"
log.warning(warn_msg)
Expand Down

0 comments on commit f4cc0fe

Please sign in to comment.