Skip to content

Commit

Permalink
Merge pull request #1994 from mashehu/fix-install-command
Browse files Browse the repository at this point in the history
Fix subworkflows install command
  • Loading branch information
mashehu committed Nov 3, 2022
2 parents 5c0d98b + d50d6a1 commit 7848faa
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
19 changes: 19 additions & 0 deletions nf_core/modules/modules_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion nf_core/modules/modules_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,14 +401,15 @@ 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)
commits_old = self.repo.iter_commits(max_count=depth, paths=component_path)
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):
Expand Down
2 changes: 1 addition & 1 deletion nf_core/subworkflows/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7848faa

Please sign in to comment.