From daf5da9a34630aba3e0c1019a1371deec0f5b904 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 24 Oct 2022 13:18:38 +0200 Subject: [PATCH 1/5] only warn valid directory if pipeline is not nf-core --- nf_core/modules/modules_command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nf_core/modules/modules_command.py b/nf_core/modules/modules_command.py index 83705a0bb7..af361718a4 100644 --- a/nf_core/modules/modules_command.py +++ b/nf_core/modules/modules_command.py @@ -64,7 +64,9 @@ def has_valid_directory(self): main_nf = os.path.join(self.dir, "main.nf") nf_config = os.path.join(self.dir, "nextflow.config") if not os.path.exists(main_nf) and not os.path.exists(nf_config): - raise UserWarning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") + if Path(self.dir).resolve().parts[-1].startswith("nf-core"): + raise UserWarning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") + log.warning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") return True def has_modules_file(self): From 5aac1567b65eb3704fad5f1491a290a9dcd7e8fd Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 24 Oct 2022 13:19:50 +0200 Subject: [PATCH 2/5] Revert "only warn valid directory if pipeline is not nf-core" This reverts commit daf5da9a34630aba3e0c1019a1371deec0f5b904. --- nf_core/modules/modules_command.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/nf_core/modules/modules_command.py b/nf_core/modules/modules_command.py index af361718a4..83705a0bb7 100644 --- a/nf_core/modules/modules_command.py +++ b/nf_core/modules/modules_command.py @@ -64,9 +64,7 @@ def has_valid_directory(self): main_nf = os.path.join(self.dir, "main.nf") nf_config = os.path.join(self.dir, "nextflow.config") if not os.path.exists(main_nf) and not os.path.exists(nf_config): - if Path(self.dir).resolve().parts[-1].startswith("nf-core"): - raise UserWarning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") - log.warning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") + raise UserWarning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") return True def has_modules_file(self): From a09e2e9d19a6f7fcbe55ce4c020f6d5490abe1c2 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 24 Oct 2022 13:20:55 +0200 Subject: [PATCH 3/5] only warn valid directory if pipeline is not nf-core --- nf_core/modules/modules_command.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nf_core/modules/modules_command.py b/nf_core/modules/modules_command.py index 83705a0bb7..af361718a4 100644 --- a/nf_core/modules/modules_command.py +++ b/nf_core/modules/modules_command.py @@ -64,7 +64,9 @@ def has_valid_directory(self): main_nf = os.path.join(self.dir, "main.nf") nf_config = os.path.join(self.dir, "nextflow.config") if not os.path.exists(main_nf) and not os.path.exists(nf_config): - raise UserWarning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") + if Path(self.dir).resolve().parts[-1].startswith("nf-core"): + raise UserWarning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") + log.warning(f"Could not find a 'main.nf' or 'nextflow.config' file in '{self.dir}'") return True def has_modules_file(self): From 8b30598a273022a37d21127a7fef903d5c84a15b Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 24 Oct 2022 13:23:14 +0200 Subject: [PATCH 4/5] modify changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d7e1afb421..def135025b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Improve test coverage of sync.py - `check_up_to_date()` function from `modules_json` also checks for subworkflows. - The default branch can now be specified when creating a new pipeline repo [#1959](https://github.com/nf-core/tools/pull/1959). +- Only warn when checking that the pipeline directory contains a `main.nf` and a `nextflow.config` file if the pipeline is not an nf-core pipeline [#1964](https://github.com/nf-core/tools/pull/1964) ### Modules From a79918ef50b7d7a368dd590a0835f1354c4c0816 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Mon, 24 Oct 2022 15:06:23 +0200 Subject: [PATCH 5/5] fix test --- tests/modules/install.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/modules/install.py b/tests/modules/install.py index 06c5173346..7b7d86c2d7 100644 --- a/tests/modules/install.py +++ b/tests/modules/install.py @@ -22,7 +22,8 @@ def test_modules_install_nopipeline(self): @with_temporary_folder def test_modules_install_emptypipeline(self, tmpdir): """Test installing a module - empty dir given""" - self.mods_install.dir = tmpdir + os.mkdir(os.path.join(tmpdir, "nf-core-pipe")) + self.mods_install.dir = os.path.join(tmpdir, "nf-core-pipe") with pytest.raises(UserWarning) as excinfo: self.mods_install.install("foo") assert "Could not find a 'main.nf' or 'nextflow.config' file" in str(excinfo.value)