From e6ccc10baa4e9160435f8c3b40ffbc95945e2624 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 23 Mar 2021 10:43:35 +0100 Subject: [PATCH 1/5] Pipeline create - apply file permissions to new files Fixes nf-core/tools#923 --- nf_core/create.py | 4 ++++ 1 file changed, 4 insertions(+) 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() From 2013dd1c1e59c50497d93820cfc9b16fcad6205c Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 23 Mar 2021 10:46:45 +0100 Subject: [PATCH 2/5] File perms on nf-core modules create too --- nf_core/modules/create.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index 89340ecf94..d01369ca3c 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(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 From dcec8299cb29174c81cee33c63289037f7365a28 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 23 Mar 2021 10:47:23 +0100 Subject: [PATCH 3/5] Changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0f267e9a92..da937bd1d8 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 [[#923](https://github.com/nf-core/tools/issues/923)] * 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 From b28dcaf94b0b5bbebbcee794994f0fa62be653d6 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 23 Mar 2021 11:00:51 +0100 Subject: [PATCH 4/5] =?UTF-8?q?Sometimes=20I=20=E2=9D=A4=EF=B8=8F=20CI=20t?= =?UTF-8?q?ests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nf_core/modules/create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/modules/create.py b/nf_core/modules/create.py index d01369ca3c..c788e01f7b 100644 --- a/nf_core/modules/create.py +++ b/nf_core/modules/create.py @@ -237,7 +237,7 @@ def render_template(self): fh.write(rendered_output) # Mirror file permissions - template_stat = os.stat(template_fn) + 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): From 618179c9bb6a6781be09e71d5ccd84a6f6435198 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Tue, 23 Mar 2021 11:58:17 +0100 Subject: [PATCH 5/5] Update CHANGELOG.md Co-authored-by: Kevin Menden --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index da937bd1d8..64b50dc04d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +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 [[#923](https://github.com/nf-core/tools/issues/923)] +* 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