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

2862 fix determine base dir #2863

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
- Update python:3.11-slim Docker digest to a2eb07f ([#2847](https://github.com/nf-core/tools/pull/2847))
- Strip out mention of "Nextflow Tower" and replace with "Seqera Platform" wherever possible
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.3.3 ([#2850](https://github.com/nf-core/tools/pull/2850))
- Fix issue with config resolution that was causing nested configs to behave unexpectedly ([#2862](https://github.com/nf-core/tools/pull/2862))

## [v2.13.1 - Tin Puppy Patch](https://github.com/nf-core/tools/releases/tag/2.13) - [2024-02-29]

Expand Down
7 changes: 4 additions & 3 deletions nf_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1047,12 +1047,13 @@ def load_tools_config(directory: Union[str, Path] = "."):

def determine_base_dir(directory="."):
base_dir = start_dir = Path(directory).absolute()
while base_dir != base_dir.parent:
# Only iterate up the tree if the start dir doesn't have a config
while not get_first_available_path(base_dir, CONFIG_PATHS) and base_dir != base_dir.parent:
base_dir = base_dir.parent
config_fn = get_first_available_path(base_dir, CONFIG_PATHS)
if config_fn:
return directory if base_dir == start_dir else base_dir
return directory
break
return directory if base_dir == start_dir else base_dir


def get_first_available_path(directory, paths):
Expand Down
Loading