From 03c85390819b98530166fc32f5c4b11df614f435 Mon Sep 17 00:00:00 2001 From: Riccardo Porreca Date: Sun, 9 Jul 2023 12:44:18 +0200 Subject: [PATCH 1/4] Temporarily remove `extract_json_object` to re-establish `No package record found!` --- conda_lock/conda_solver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_lock/conda_solver.py b/conda_lock/conda_solver.py index 402bb143..be65c888 100644 --- a/conda_lock/conda_solver.py +++ b/conda_lock/conda_solver.py @@ -492,7 +492,7 @@ def update_specs_for_arch( f"Could not lock the environment for platform {platform}: {err_json.get('message')}" ) from exc - dryrun_install: DryRunInstall = json.loads(extract_json_object(proc.stdout)) + dryrun_install: DryRunInstall = json.loads(proc.stdout) else: dryrun_install = {"actions": {"LINK": [], "FETCH": []}} From 7b9631974c13ed9a7a152ef2b1b2a9a22be86388 Mon Sep 17 00:00:00 2001 From: Riccardo Porreca Date: Sun, 9 Jul 2023 13:41:08 +0200 Subject: [PATCH 2/4] Include file name ("fn") in fake environment JSON files Should fix #452 with mamba>=1.4.6 --- conda_lock/conda_solver.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conda_lock/conda_solver.py b/conda_lock/conda_solver.py index be65c888..7a7fa809 100644 --- a/conda_lock/conda_solver.py +++ b/conda_lock/conda_solver.py @@ -561,6 +561,7 @@ def fake_conda_environment( channel = urlunsplit( (url.scheme, url.hostname, str(path.parent), None, None) ) + file_name = path.name while path.suffix in {".tar", ".bz2", ".gz", ".conda"}: path = path.with_suffix("") build = path.name.split("-")[-1] @@ -577,6 +578,7 @@ def fake_conda_environment( "build_number": build_number, "version": dep.version, "subdir": path.parent.name, + "fn": file_name, "depends": [f"{k} {v}".strip() for k, v in dep.dependencies.items()], } # mamba requires these to be stringlike so null are not allowed here From 3af671d21896464cb3986c7351a7824103e25cd0 Mon Sep 17 00:00:00 2001 From: Riccardo Porreca Date: Sun, 9 Jul 2023 17:45:27 +0200 Subject: [PATCH 3/4] Revert "Temporarily remove `extract_json_object` to re-establish `No package record found!`" This reverts commit 03c85390819b98530166fc32f5c4b11df614f435. --- conda_lock/conda_solver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda_lock/conda_solver.py b/conda_lock/conda_solver.py index 7a7fa809..c061d44e 100644 --- a/conda_lock/conda_solver.py +++ b/conda_lock/conda_solver.py @@ -492,7 +492,7 @@ def update_specs_for_arch( f"Could not lock the environment for platform {platform}: {err_json.get('message')}" ) from exc - dryrun_install: DryRunInstall = json.loads(proc.stdout) + dryrun_install: DryRunInstall = json.loads(extract_json_object(proc.stdout)) else: dryrun_install = {"actions": {"LINK": [], "FETCH": []}} From b2791b688e841f867b64b7d605849f6b1076e005 Mon Sep 17 00:00:00 2001 From: Riccardo Porreca Date: Sun, 9 Jul 2023 18:04:31 +0200 Subject: [PATCH 4/4] Use `path.name` directly w/o assignment Apply suggestions from code review Co-authored-by: Ben Mares --- conda_lock/conda_solver.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conda_lock/conda_solver.py b/conda_lock/conda_solver.py index c061d44e..12e843a0 100644 --- a/conda_lock/conda_solver.py +++ b/conda_lock/conda_solver.py @@ -561,7 +561,6 @@ def fake_conda_environment( channel = urlunsplit( (url.scheme, url.hostname, str(path.parent), None, None) ) - file_name = path.name while path.suffix in {".tar", ".bz2", ".gz", ".conda"}: path = path.with_suffix("") build = path.name.split("-")[-1] @@ -578,7 +577,7 @@ def fake_conda_environment( "build_number": build_number, "version": dep.version, "subdir": path.parent.name, - "fn": file_name, + "fn": path.name, "depends": [f"{k} {v}".strip() for k, v in dep.dependencies.items()], } # mamba requires these to be stringlike so null are not allowed here