From 5098453c725428ec0cec2552ee8a779fe0bbcb41 Mon Sep 17 00:00:00 2001 From: Riccardo Porreca Date: Thu, 11 Aug 2022 01:29:30 +0200 Subject: [PATCH] Make sure to always re-check defaults source files even when falling back from the source files in the lockfile (#231). --- conda_lock/conda_lock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conda_lock/conda_lock.py b/conda_lock/conda_lock.py index 455be0c7..1363e460 100644 --- a/conda_lock/conda_lock.py +++ b/conda_lock/conda_lock.py @@ -932,15 +932,15 @@ def run_lock( if all(p.exists() for p in locked_environment_files): environment_files = locked_environment_files else: - environment_files = DEFAULT_FILES missing = [p for p in locked_environment_files if not p.exists()] print( f"{lockfile_path} was created from {[str(p) for p in locked_environment_files]}," f" but some files ({[str(p) for p in missing]}) do not exist. Falling back to" - f" {[str(p) for p in environment_files]}.", + f" {[str(p) for p in DEFAULT_FILES]}.", file=sys.stderr, ) - else: + # always re-check in case no files from the lockfile were assigned + if len(environment_files) == 0: # bail out if we do not encounter any default .y(a)ml files candidates = [ p if p.exists() else p.with_suffix(".yaml") for p in DEFAULT_FILES