WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
28 changes: 6 additions & 22 deletions conda_build/environ.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
)
from conda.base.context import context, reset_context
from conda.common.io import env_vars
from conda.core.index import LAST_CHANNEL_URLS
from conda.core.link import PrefixSetup, UnlinkLinkTransaction
from conda.core.package_cache_data import PackageCacheData, ProgressiveFetchExtract
from conda.core.prefix_data import PrefixData
Expand All @@ -38,7 +37,7 @@
UnsatisfiableError,
)
from conda.gateways.disk.create import TemporaryDirectory
from conda.models.channel import Channel, prioritize_channels
from conda.models.channel import Channel
from conda.models.match_spec import MatchSpec
from conda.models.records import PackageRecord

Expand All @@ -62,6 +61,8 @@
from pathlib import Path
from typing import Any, TypedDict

from conda.core.index import Index

from .config import Config
from .metadata import MetaData

Expand Down Expand Up @@ -1262,7 +1263,7 @@ def get_pinned_deps(m, section):
# checks for this name in the call stack explicitly.
def install_actions(
prefix: str | os.PathLike | Path,
index,
index: Index,
specs: Iterable[str | MatchSpec],
subdir: str | None = None,
) -> InstallActionsType:
Expand All @@ -1280,25 +1281,8 @@ def install_actions(
},
callback=reset_context,
):
# a hack since in conda-build we don't track channel_priority_map
channels: tuple[Channel, ...] | None
subdirs: tuple[str, ...] | None
if LAST_CHANNEL_URLS:
channel_priority_map = prioritize_channels(LAST_CHANNEL_URLS)
# tuple(dict.fromkeys(...)) removes duplicates while preserving input order.
channels = tuple(
dict.fromkeys(Channel(url) for url in channel_priority_map)
)
subdirs = (
tuple(
dict.fromkeys(
subdir for channel in channels if (subdir := channel.subdir)
)
)
or context.subdirs
)
else:
channels = subdirs = None
channels: tuple[Channel, ...] | None = tuple(index.expanded_channels) or None
subdirs: tuple[str, ...] | None = tuple(index._subdirs) or None

mspecs = tuple(MatchSpec(spec) for spec in specs)

Expand Down
15 changes: 1 addition & 14 deletions conda_build/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import os
from functools import partial
from os.path import dirname
from typing import TYPE_CHECKING

from conda.base.context import context
from conda.core.index import Index
from conda.exceptions import CondaHTTPError
from conda.utils import url_path

Expand All @@ -17,9 +17,6 @@
get_logger,
)

if TYPE_CHECKING:
from conda.models.channels import Channel

try:
from conda_index.index import update_index as _update_index
except ImportError:
Expand All @@ -28,16 +25,6 @@
)


try:
from conda.core.index import Index
except ImportError:
# FUTURE: remove for `conda >=24.9`
from conda.core.index import get_index

def Index(channels: tuple[str | Channel, ...] = (), *args, **kwargs) -> dict: # type: ignore[no-redef]
return get_index(channel_urls=channels, *args, **kwargs)


log = get_logger(__name__)


Expand Down
7 changes: 1 addition & 6 deletions conda_build/inspect_pkg.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from conda.api import Solver
from conda.base.context import context
from conda.cli.common import specs_from_args
from conda.core.index import Index
from conda.core.prefix_data import PrefixData
from conda.models.records import PrefixRecord

Expand All @@ -37,12 +38,6 @@
package_has_file,
)

try:
from conda.core.index import Index
except ImportError:
# FUTURE: remove for `conda >=24.9`
from conda_build.index import Index

if TYPE_CHECKING:
from collections.abc import Iterable
from typing import Literal
Expand Down
7 changes: 1 addition & 6 deletions conda_build/skeletons/cpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from os.path import basename, dirname, exists, join

import requests
from conda.core.index import Index
from conda.exceptions import CondaError, CondaHTTPError
from conda.gateways.connection.download import TmpDownload, download
from conda.gateways.disk.create import TemporaryDirectory
Expand All @@ -33,12 +34,6 @@
from ..variants import get_default_variant
from ..version import _parse as parse_version

try:
from conda.core.index import Index
except ImportError:
# FUTURE: remove for `conda >=24.9`
from conda_build.index import Index

CPAN_META = """\
{{% set name = "{packagename}" %}}
{{% set version = "{version}" %}}
Expand Down
19 changes: 19 additions & 0 deletions news/5857-empty-channels.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* <news item>

### Bug fixes

* Prevent empty channel lists from being passed to host environment creation. (#5857)

### Deprecations

* Remove fallback imports for `conda.core.index.Index`. (#5857)

### Docs

* <news item>

### Other

* <news item>
Loading