Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't write file when applying a patch during update #2017

Merged
merged 10 commits into from
Nov 14, 2022
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
### Modules

- Update patch file paths if the modules directory has the old structure ([#1878](https://github.com/nf-core/tools/pull/1878))
- Don't write to `modules.json` file when applying a patch file during `nf-core modules update`

### Subworkflows

Expand Down
6 changes: 3 additions & 3 deletions nf_core/modules/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def update(self, module=None):

if patch_relpath is not None:
patch_successful = self.try_apply_patch(
module, modules_repo.repo_path, patch_relpath, module_dir, module_install_dir
module, modules_repo.repo_path, patch_relpath, module_dir, module_install_dir, write_file=False
)
if patch_successful:
log.info(f"Module '{module_fullname}' patched successfully")
Expand Down Expand Up @@ -630,7 +630,7 @@ def move_files_from_tmp_dir(self, module, install_folder, repo_path, new_version
log.info(f"Updating '{repo_path}/{module}'")
log.debug(f"Updating module '{module}' to {new_version} from {repo_path}")

def try_apply_patch(self, module, repo_path, patch_relpath, module_dir, module_install_dir):
def try_apply_patch(self, module, repo_path, patch_relpath, module_dir, module_install_dir, write_file=True):
"""
Try applying a patch file to the new module files

Expand Down Expand Up @@ -698,7 +698,7 @@ def try_apply_patch(self, module, repo_path, patch_relpath, module_dir, module_i

# Add the patch file to the modules.json file
self.modules_json.add_patch_entry(
module, self.modules_repo.remote_url, repo_path, patch_relpath, write_file=True
module, self.modules_repo.remote_url, repo_path, patch_relpath, write_file=write_file
)

return True