diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f267e9a92..64b50dc04d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ * Added better logging message if a user doesn't specificy the directory correctly with `nf-core modules` commands [[#942](https://github.com/nf-core/tools/pull/942)] * Fixed parameter validation bug caused by JSONObject [[#937](https://github.com/nf-core/tools/issues/937)] +* Fixed template creation error regarding file permissions [[#932](https://github.com/nf-core/tools/issues/932)] * Split the `create-lint-wf` tests up into separate steps in GitHub Actions to make the CI results easier to read * Added automated PR comments to the Markdownlint and Python Black lint CI tests to explain failures diff --git a/nf_core/create.py b/nf_core/create.py index 2492169486..bf4271b6d3 100644 --- a/nf_core/create.py +++ b/nf_core/create.py @@ -134,6 +134,10 @@ def render_template(self): shutil.copy(template_fn_path, output_path) continue + # Mirror file permissions + template_stat = os.stat(template_fn_path) + os.chmod(output_path, template_stat.st_mode) + # Make a logo and save it self.make_pipeline_logo() diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index 89340ecf94..c788e01f7b 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -236,6 +236,10 @@ def render_template(self): log.debug(f"Writing output to: '{dest_fn}'") fh.write(rendered_output) + # Mirror file permissions + template_stat = os.stat(os.path.join("nf_core", "module-template", template_fn)) + os.chmod(dest_fn, template_stat.st_mode) + def get_repo_type(self, directory): """ Determine whether this is a pipeline repository or a clone of