From fb5704148e4c3630f7e3b4f695cc6a509838bbd1 Mon Sep 17 00:00:00 2001 From: Erik Danielsson Date: Fri, 5 Aug 2022 17:47:56 +0200 Subject: [PATCH 1/3] Fix the issue --- CHANGELOG.md | 1 + nf_core/modules/update.py | 27 +++++++++++---------------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c84d203a77..25fdd990b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ - Add links in `README.md` for `info` and `patch` commands ([#1722](https://github.com/nf-core/tools/issues/1722)]) - Fix misc. issues with `--branch` and `--base-path` ([#1726](https://github.com/nf-core/tools/issues/1726)) - Add `branch` field to module entries in `modules.json` to record what branch a module was installed from ([#1728](https://github.com/nf-core/tools/issues/1728)) +- Fix unbound variable issues and minor refactoring. ## [v2.4.1 - Cobolt Koala Patch](https://github.com/nf-core/tools/releases/tag/2.4) - [2022-05-16] diff --git a/nf_core/modules/update.py b/nf_core/modules/update.py index 5ca96a1136..0255303753 100644 --- a/nf_core/modules/update.py +++ b/nf_core/modules/update.py @@ -46,17 +46,6 @@ def __init__( self.modules_json = ModulesJson(self.dir) self.branch = branch - class DiffEnum(enum.Enum): - """Enumeration to keeping track of file diffs. - - Used for the --save-diff and --preview options - """ - - UNCHANGED = enum.auto() - CHANGED = enum.auto() - CREATED = enum.auto() - REMOVED = enum.auto() - def _parameter_checks(self): """Checks the compatibilty of the supplied parameters. @@ -431,18 +420,24 @@ def get_all_modules_info(self, branch=None): # Get the git urls from the modules.json modules_info = ( - (self.modules_json.get_git_url(repo_name), branch, self.modules_json.get_base_path(repo_name), mods_shas) + ( + repo_name, + self.modules_json.get_git_url(repo_name), + branch, + self.modules_json.get_base_path(repo_name), + mods_shas, + ) for (repo_name, branch), mods_shas in repos_and_branches.items() ) # Create ModulesRepo objects repo_objs_mods = [] - for repo_url, branch, base_path, mods_shas in modules_info: + for repo_name, repo_url, branch, base_path, mods_shas in modules_info: try: modules_repo = ModulesRepo(remote_url=repo_url, branch=branch, base_path=base_path) except LookupError as e: log.warning(e) - log.info(f"Skipping modules in '{modules_repo.fullname}'") + log.info(f"Skipping modules in '{repo_name}'") else: repo_objs_mods.append((modules_repo, mods_shas)) @@ -453,13 +448,13 @@ def get_all_modules_info(self, branch=None): # don't try to update those that don't i = 0 while i < len(modules_info): - repo, module, _ = modules_info[i] + repo, module, sha = modules_info[i] if not repo.module_exists(module): log.warning(f"Module '{module}' does not exist in '{repo.fullname}'. Skipping...") modules_info.pop(i) elif sha is not None and not repo.sha_exists_on_branch(sha): log.warning( - f"Git sha '{sha}' does not exists on the '{branch}' of '{repo.fullname}'. Skipping module '{mod}'" + f"Git sha '{sha}' does not exists on the '{repo.branch}' of '{repo.fullname}'. Skipping module '{mod}'" ) modules_info.pop(i) else: From a0549e884d2a6d92315a97aea79131dc0067c691 Mon Sep 17 00:00:00 2001 From: Erik Danielsson <53212377+ErikDanielsson@users.noreply.github.com> Date: Fri, 5 Aug 2022 18:18:25 +0200 Subject: [PATCH 2/3] Update nf_core/modules/update.py Co-authored-by: Fabian Egli --- nf_core/modules/update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/modules/update.py b/nf_core/modules/update.py index 0255303753..59e7ceaaa4 100644 --- a/nf_core/modules/update.py +++ b/nf_core/modules/update.py @@ -454,7 +454,7 @@ def get_all_modules_info(self, branch=None): modules_info.pop(i) elif sha is not None and not repo.sha_exists_on_branch(sha): log.warning( - f"Git sha '{sha}' does not exists on the '{repo.branch}' of '{repo.fullname}'. Skipping module '{mod}'" + f"Git sha '{sha}' does not exists on the '{repo.branch}' of '{repo.fullname}'. Skipping module '{module}'" ) modules_info.pop(i) else: From 1eebfa0c92a178aced278227aa0ee571f4723a16 Mon Sep 17 00:00:00 2001 From: Fabian Egli Date: Fri, 5 Aug 2022 18:21:20 +0200 Subject: [PATCH 3/3] add link to PR --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25fdd990b1..f099dda2e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,7 +70,7 @@ - Add links in `README.md` for `info` and `patch` commands ([#1722](https://github.com/nf-core/tools/issues/1722)]) - Fix misc. issues with `--branch` and `--base-path` ([#1726](https://github.com/nf-core/tools/issues/1726)) - Add `branch` field to module entries in `modules.json` to record what branch a module was installed from ([#1728](https://github.com/nf-core/tools/issues/1728)) -- Fix unbound variable issues and minor refactoring. +- Fix unbound variable issues and minor refactoring [#1742](https://github.com/nf-core/tools/pull/1742/) ## [v2.4.1 - Cobolt Koala Patch](https://github.com/nf-core/tools/releases/tag/2.4) - [2022-05-16]