mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-90203 fix conda_packaging_tool.py compatibility with conda 26
conda 26 changed the SubdirData.query_all signature: channels and subdirs are now required keyword arguments. conda 25 inferred them from the current context when only a MatchSpec was passed. Calling query_all with just a spec on conda 26 raises TypeError, breaking the package index loading entirely. Fix: try the explicit form with channels= and subdirs= kwargs first (required by conda 26), catch TypeError and fall back to the single-spec form (conda 25 and earlier). Also add CONDA_26 (py312_26.5.3-1) to PredefinedPyEnvironments and CondaPackagingToolHelperTest so future regressions in the version-routing logic are caught before release. (cherry picked from commit 807bc29f329a3ca1c323ccc2fd6f2e7a391be2df) IJ-MR-212935 GitOrigin-RevId: 8c6b42702a4ed3fd88f00b4e5a6ef9b3ade38853
This commit is contained in:
committed by
intellij-monorepo-bot
parent
ae32153048
commit
8d1a6140a5
@@ -44,10 +44,8 @@ def _iter_packages(major_version, minor_version):
|
||||
objects (attribute access) instead of the legacy dict-like entries returned by ``get_index``.
|
||||
"""
|
||||
if major_version >= 25:
|
||||
init_context()
|
||||
from conda.core.subdir_data import SubdirData
|
||||
for pkg in SubdirData.query_all('*'):
|
||||
yield Pkg(name=pkg.name, version=pkg.version, depends=pkg.depends)
|
||||
for pkg in _iter_packages_subdir_data():
|
||||
yield pkg
|
||||
return
|
||||
|
||||
if major_version >= 22 or (major_version >= 4 and minor_version >= 4):
|
||||
@@ -68,6 +66,39 @@ def _iter_packages(major_version, minor_version):
|
||||
yield Pkg(name=pkg["name"], version=pkg["version"], depends=pkg["depends"])
|
||||
|
||||
|
||||
def _iter_packages_subdir_data():
|
||||
"""Iterate package records via ``SubdirData`` for conda 25+.
|
||||
|
||||
The ``SubdirData.query_all`` signature changed across releases: conda 25 accepts a single
|
||||
positional ``MatchSpec`` and infers ``channels``/``subdirs`` from the current context, while
|
||||
conda 26 made ``channels`` and ``subdirs`` required keyword arguments (passing only the spec
|
||||
raises ``TypeError``). Try the modern explicit form first, then fall back to the older one.
|
||||
"""
|
||||
context = init_context()
|
||||
from conda.core.subdir_data import SubdirData
|
||||
try:
|
||||
from conda.models.match_spec import MatchSpec
|
||||
spec = MatchSpec("*")
|
||||
except ImportError:
|
||||
spec = "*"
|
||||
|
||||
channels = getattr(context, "channels", None) if context is not None else None
|
||||
subdirs = getattr(context, "subdirs", None) if context is not None else None
|
||||
|
||||
records = None
|
||||
if channels is not None and subdirs is not None:
|
||||
try:
|
||||
records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs)
|
||||
except TypeError:
|
||||
records = None
|
||||
|
||||
if records is None:
|
||||
records = SubdirData.query_all(spec)
|
||||
|
||||
for pkg in records:
|
||||
yield Pkg(name=pkg.name, version=pkg.version, depends=pkg.depends)
|
||||
|
||||
|
||||
def do_list_channels():
|
||||
context = init_context()
|
||||
if context:
|
||||
|
||||
Vendored
+11
-1
@@ -211,6 +211,15 @@ enum class PredefinedPyEnvironments(val spec: PyEnvironmentSpec<*>) {
|
||||
*/
|
||||
CONDA_25(condaEnvironment("py312_25.11.1-1") {
|
||||
pythonVersion = pythonVersion("3.12")
|
||||
}),
|
||||
|
||||
/**
|
||||
* Conda 26.x environment used by helper-script tests to verify that the index-loading
|
||||
* code path continues to work on the latest major conda release.
|
||||
* Tags: conda, conda26
|
||||
*/
|
||||
CONDA_26(condaEnvironment("py312_26.5.3-1") {
|
||||
pythonVersion = pythonVersion("3.12")
|
||||
});
|
||||
|
||||
companion object {
|
||||
@@ -241,7 +250,8 @@ enum class PredefinedPyEnvironments(val spec: PyEnvironmentSpec<*>) {
|
||||
VENV_3_14 to setOf("python3", "python3.14", "ruff"),
|
||||
VANILLA_3_14 to setOf("vanilla"),
|
||||
CONDA to setOf("conda"),
|
||||
CONDA_25 to setOf("conda", "conda25")
|
||||
CONDA_25 to setOf("conda", "conda25"),
|
||||
CONDA_26 to setOf("conda", "conda26")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user