diff --git a/nf_core/modules/modules_json.py b/nf_core/modules/modules_json.py index b1f1ab3ca8..96a62dd2ef 100644 --- a/nf_core/modules/modules_json.py +++ b/nf_core/modules/modules_json.py @@ -784,6 +784,25 @@ def get_all_modules(self): return self.pipeline_modules + def get_all_components(self, component_type): + """ + Retrieves all pipeline modules/subworkflows that are reported in the modules.json + + Returns: + (dict[str, [(str, str)]]): Dictionary indexed with the repo urls, with a + list of tuples (component_dir, components) as values + """ + if self.modules_json is None: + self.load() + if self.pipeline_components is None: + self.pipeline_components = {} + for repo, repo_entry in self.modules_json.get("repos", {}).items(): + if "modules" in repo_entry: + for dir, modules in repo_entry[component_type].items(): + self.pipeline_components[repo] = [(dir, m) for m in modules] + + return self.pipeline_modules + def get_module_branch(self, module, repo_url, install_dir): """ Gets the branch from which the module was installed diff --git a/nf_core/modules/modules_repo.py b/nf_core/modules/modules_repo.py index 1c242b4764..d0a831c933 100644 --- a/nf_core/modules/modules_repo.py +++ b/nf_core/modules/modules_repo.py @@ -401,6 +401,7 @@ def get_component_git_log(self, component_name, component_type, depth=None): commits_new = [ {"git_sha": commit.hexsha, "trunc_message": commit.message.partition("\n")[0]} for commit in commits_new ] + commits_old = [] if component_type == "modules": # Grab commits also from previous modules structure component_path = os.path.join("modules", component_name) @@ -408,7 +409,7 @@ def get_component_git_log(self, component_name, component_type, depth=None): commits_old = [ {"git_sha": commit.hexsha, "trunc_message": commit.message.partition("\n")[0]} for commit in commits_old ] - commits = iter(commits_new + commits_old) + commits = iter(commits_new + commits_old) return commits def get_latest_component_version(self, component_name, component_type): diff --git a/nf_core/subworkflows/install.py b/nf_core/subworkflows/install.py index a5f0c63dcb..439cf187b7 100644 --- a/nf_core/subworkflows/install.py +++ b/nf_core/subworkflows/install.py @@ -91,7 +91,7 @@ def install(self, subworkflow, silent=False): log.debug(f"Installing subworkflow '{subworkflow}' at hash {version} from {self.modules_repo.remote_url}") # Download subworkflow files - if not self.install_subworkflow_files(subworkflow, version, self.modules_repo, install_folder): + if not self.install_component_files(subworkflow, version, self.modules_repo, install_folder): return False # Install included modules and subworkflows