Skip to content

Commit

Permalink
Merge branch 'main' into nushell
Browse files Browse the repository at this point in the history
  • Loading branch information
cvanelteren authored Aug 5, 2023
2 parents dc2dee8 + 1400c4e commit 52f8668
Show file tree
Hide file tree
Showing 5 changed files with 885 additions and 937 deletions.
5 changes: 2 additions & 3 deletions mamba/mamba/mamba_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
get_installed_jsonfile,
init_api_context,
load_channels,
load_conda_installed,
to_txn,
to_txn_precs,
)
Expand Down Expand Up @@ -79,9 +80,7 @@ def mamba_install(prefix, specs, args, env, dry_run=False, *_, **kwargs):
with tempfile.TemporaryDirectory() as td:
installed_json_f, installed_pkg_recs = get_installed_jsonfile(td)

prefix_data = api.PrefixData(context.target_prefix)
prefix_data.add_packages(api.get_virtual_packages())
repo = api.Repo(pool, prefix_data)
repo = load_conda_installed(pool, installed_json_f, installed_pkg_recs)
repos.append(repo)

solver = api.Solver(pool, solver_options)
Expand Down
17 changes: 17 additions & 0 deletions mamba/mamba/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@
import libmambapy as api


def load_conda_installed(pool, installed_json_f, installed_pkg_recs):
repo = api.Repo(pool, "installed", installed_json_f.name, "")
additional_infos = {}
for rec in installed_pkg_recs:
info = api.ExtraPkgInfo()
if rec.noarch:
info.noarch = rec.noarch.value
if rec.url:
info.repo_url = rec.url
additional_infos[rec.name] = info

repo.add_extra_pkg_info(additional_infos)
repo.set_installed()

return repo


def load_channel(subdir_data, result_container):
if not context.quiet:
print("Getting ", subdir_data.channel.name, subdir_data.channel.platform)
Expand Down
3 changes: 2 additions & 1 deletion micromamba/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ def tmp_root_prefix(
# Pytest would clean it automatically but this can be large (0.5 Gb for repodata)
# We clean it explicitly
if not request.config.getoption("--no-eager-clean"):
helpers.rmtree(new_root_prefix)
if new_root_prefix.exists():
helpers.rmtree(new_root_prefix)
# os.environ restored by tmp_clean_env and tmp_environ


Expand Down
Loading

0 comments on commit 52f8668

Please sign in to comment.