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

use index in offline mode when called from conda-build #395

Merged
merged 7 commits into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 7 additions & 0 deletions conda_libmamba_solver/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,3 +409,10 @@ def _process_query_result(

# for conda-build
_CachedLibMambaIndexHelper = lru_cache(maxsize=None)(LibMambaIndexHelper)


# conda-build needs to operate offline for the index
def _LibMambaIndexHelperOffline(*args, **kwargs):
with context._override("offline", True):
jaimergp marked this conversation as resolved.
Show resolved Hide resolved
helper = _CachedLibMambaIndexHelper(*args, **kwargs)
return helper
4 changes: 2 additions & 2 deletions conda_libmamba_solver/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

from . import __version__
from .exceptions import LibMambaUnsatisfiableError
from .index import LibMambaIndexHelper, _CachedLibMambaIndexHelper
from .index import LibMambaIndexHelper, _LibMambaIndexHelperOffline
from .mamba_utils import init_api_context, mamba_version
from .state import SolverInputState, SolverOutputState
from .utils import is_channel_available
Expand Down Expand Up @@ -175,7 +175,7 @@ def solve_final_state(
rec.channel: None for rec in self._index if rec.channel.scheme == "file"
}
# Cache indices for conda-build, it gets heavy otherwise
IndexHelper = _CachedLibMambaIndexHelper
IndexHelper = _LibMambaIndexHelperOffline
else:
IndexHelper = LibMambaIndexHelper
conda_bld_channels = ()
Expand Down
2 changes: 1 addition & 1 deletion tests/data/conda_build_recipes/stackvana/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% set name = "stackvana-core" %}
{% set name = "stackvana-split" %}
{% set version = "0.2021.43" %}
{% set eups_product = "lsst_distrib" %}

Expand Down
Loading