From 0ae9316575120145c4fa0cb37ce1b9dd78759f28 Mon Sep 17 00:00:00 2001 From: Ben Mares Date: Thu, 17 Oct 2024 12:29:07 +0200 Subject: [PATCH] Handle either "pkgs_dirs" or "package cache" as the key This fixes the test. --- conda_lock/conda_solver.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/conda_lock/conda_solver.py b/conda_lock/conda_solver.py index 448c44eb..54c27671 100644 --- a/conda_lock/conda_solver.py +++ b/conda_lock/conda_solver.py @@ -265,7 +265,16 @@ def _get_pkgs_dirs( output = subprocess.check_output(args, env=env).decode() json_object_str = extract_json_object(output) json_object: dict[str, Any] = json.loads(json_object_str) - pkgs_dirs_list: list[str] = json_object["pkgs_dirs"] + pkgs_dirs_list: list[str] + if "pkgs_dirs" in json_object: + pkgs_dirs_list = json_object["pkgs_dirs"] + elif "package cache" in json_object: + pkgs_dirs_list = json_object["package cache"] + else: + raise ValueError( + f"Unable to extract pkgs_dirs from {json_object}. " + "Please report this issue to the conda-lock developers." + ) pkgs_dirs = [pathlib.Path(d) for d in pkgs_dirs_list] return pkgs_dirs