@anaconda/desktop-bridge-payload-win32-arm64 0.1.21 → 0.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES +17 -17
- package/manifest.json +7 -7
- package/package.json +1 -1
- package/python/BUILD +1 -1
- package/python/DLLs/_asyncio.pyd +0 -0
- package/python/DLLs/_bz2.pyd +0 -0
- package/python/DLLs/_ctypes.pyd +0 -0
- package/python/DLLs/_ctypes_test.pyd +0 -0
- package/python/DLLs/_decimal.pyd +0 -0
- package/python/DLLs/_elementtree.pyd +0 -0
- package/python/DLLs/_hashlib.pyd +0 -0
- package/python/DLLs/_lzma.pyd +0 -0
- package/python/DLLs/_msi.pyd +0 -0
- package/python/DLLs/_multiprocessing.pyd +0 -0
- package/python/DLLs/_overlapped.pyd +0 -0
- package/python/DLLs/_queue.pyd +0 -0
- package/python/DLLs/_socket.pyd +0 -0
- package/python/DLLs/_sqlite3.pyd +0 -0
- package/python/DLLs/_ssl.pyd +0 -0
- package/python/DLLs/_testbuffer.pyd +0 -0
- package/python/DLLs/_testcapi.pyd +0 -0
- package/python/DLLs/_testconsole.pyd +0 -0
- package/python/DLLs/_testimportmultiple.pyd +0 -0
- package/python/DLLs/_testinternalcapi.pyd +0 -0
- package/python/DLLs/_testmultiphase.pyd +0 -0
- package/python/DLLs/_uuid.pyd +0 -0
- package/python/DLLs/_zoneinfo.pyd +0 -0
- package/python/DLLs/libcrypto-3-arm64.dll +0 -0
- package/python/DLLs/libffi-8.dll +0 -0
- package/python/DLLs/libssl-3-arm64.dll +0 -0
- package/python/DLLs/pyexpat.pyd +0 -0
- package/python/DLLs/select.pyd +0 -0
- package/python/DLLs/sqlite3.dll +0 -0
- package/python/DLLs/unicodedata.pyd +0 -0
- package/python/DLLs/winsound.pyd +0 -0
- package/python/Lib/site-packages/_ruamel_yaml.cp311-win_arm64.pyd +0 -0
- package/python/Lib/site-packages/anaconda_anon_usage-0.8.1.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/anaconda_auth-0.15.3.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/anaconda_cli_base-0.9.1.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/anaconda_desktop_bridge/__main__.py +8 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/__pycache__/__main__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/__pycache__/errors.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/__pycache__/telemetry.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/__init__.py +2 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/__pycache__/__init__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/__pycache__/auth_handler.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/__pycache__/auth_plugin.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/__pycache__/lock.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/__pycache__/repo_credentials.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/auth_handler.py +219 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/auth_plugin.py +50 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/lock.py +26 -1
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/operations/__pycache__/channels.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/operations/__pycache__/repodata.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/operations/channels.py +196 -4
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/operations/repodata.py +8 -1
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/repo_credentials.py +224 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/transactions/__pycache__/transaction.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/conda/transactions/transaction.py +23 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/errors.py +24 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/features/__pycache__/conda_tools.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/features/conda_tools.py +8 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/models/__pycache__/conda_tools.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/anaconda_desktop_bridge/models/conda_tools.py +46 -1
- package/python/Lib/site-packages/anaconda_desktop_bridge/telemetry.py +2 -20
- package/python/Lib/site-packages/anaconda_desktop_bridge-0.1.0.dist-info/METADATA +75 -5
- package/python/Lib/site-packages/anaconda_desktop_bridge-0.1.0.dist-info/RECORD +16 -13
- package/python/Lib/site-packages/anaconda_desktop_bridge-0.1.0.dist-info/uv_cache.json +1 -1
- package/python/Lib/site-packages/archspec-0.2.7.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/cffi-2.1.1.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/charset_normalizer-3.5.2.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/conda-26.1.1.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/conda_package_handling-2.6.0.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/distro-1.9.0.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/httpx-0.28.1.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/idna-3.20.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/jsonpatch-1.47.dist-info/RECORD +2 -2
- package/python/Lib/site-packages/keyring-25.7.0.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/markdown_it_py-4.3.0.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/menuinst/platforms/win_utils/winshortcut.cp311-win_arm64.pyd +0 -0
- package/python/Lib/site-packages/menuinst-2.5.1.dist-info/RECORD +2 -2
- package/python/Lib/site-packages/platformdirs/__init__.py +155 -128
- package/python/Lib/site-packages/platformdirs/__main__.py +10 -10
- package/python/Lib/site-packages/platformdirs/__pycache__/__init__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/__main__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/_android.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/_runtime.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/_xdg.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/android.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/api.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/ios.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/macos.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/pytest_plugin.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/testing.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/unix.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/version.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/__pycache__/windows.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/platformdirs/_android.py +67 -0
- package/python/Lib/site-packages/platformdirs/_runtime.py +65 -0
- package/python/Lib/site-packages/platformdirs/_xdg.py +50 -47
- package/python/Lib/site-packages/platformdirs/android.py +64 -112
- package/python/Lib/site-packages/platformdirs/api.py +384 -293
- package/python/Lib/site-packages/platformdirs/ios.py +40 -40
- package/python/Lib/site-packages/platformdirs/macos.py +95 -72
- package/python/Lib/site-packages/platformdirs/pytest_plugin.py +5 -4
- package/python/Lib/site-packages/platformdirs/testing.py +23 -21
- package/python/Lib/site-packages/platformdirs/unix.py +158 -169
- package/python/Lib/site-packages/platformdirs/version.py +2 -2
- package/python/Lib/site-packages/platformdirs/windows.py +135 -121
- package/python/Lib/site-packages/{platformdirs-4.14.5.dist-info → platformdirs-4.14.7.dist-info}/METADATA +1 -1
- package/python/Lib/site-packages/platformdirs-4.14.7.dist-info/RECORD +23 -0
- package/python/Lib/site-packages/{pydantic_settings-2.16.2.dist-info → platformdirs-4.14.7.dist-info}/WHEEL +1 -1
- package/python/Lib/site-packages/platformdirs-4.14.7.dist-info/sboms/platformdirs.cdx.json +14820 -0
- package/python/Lib/site-packages/pycosat-0.6.6.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/pycosat.cp311-win_arm64.pyd +0 -0
- package/python/Lib/site-packages/pydantic_settings/__pycache__/version.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/pydantic_settings/sources/providers/__pycache__/cli.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/pydantic_settings/sources/providers/__pycache__/nested_secrets.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/pydantic_settings/sources/providers/__pycache__/secrets.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/pydantic_settings/sources/providers/cli.py +13 -16
- package/python/Lib/site-packages/pydantic_settings/sources/providers/nested_secrets.py +32 -18
- package/python/Lib/site-packages/pydantic_settings/sources/providers/secrets.py +20 -1
- package/python/Lib/site-packages/pydantic_settings/version.py +1 -1
- package/python/Lib/site-packages/{pydantic_settings-2.16.2.dist-info → pydantic_settings-2.16.3.dist-info}/METADATA +1 -1
- package/python/Lib/site-packages/{pydantic_settings-2.16.2.dist-info → pydantic_settings-2.16.3.dist-info}/RECORD +10 -10
- package/python/Lib/site-packages/pygments-2.21.0.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/python_dotenv-1.2.4.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/ruamel_yaml_clib-0.2.15.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/semver/__about__.py +1 -1
- package/python/Lib/site-packages/semver/__pycache__/__about__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/semver/__pycache__/version.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/semver/version.py +16 -5
- package/python/Lib/site-packages/{semver-3.1.1.dist-info → semver-3.1.2.dist-info}/METADATA +1 -1
- package/python/Lib/site-packages/semver-3.1.2.dist-info/RECORD +17 -0
- package/python/Lib/site-packages/sentry_sdk/__pycache__/_types.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/__pycache__/client.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/__pycache__/consts.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/__pycache__/traces.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/__pycache__/utils.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/_types.py +27 -3
- package/python/Lib/site-packages/sentry_sdk/client.py +1 -1
- package/python/Lib/site-packages/sentry_sdk/consts.py +7 -1
- package/python/Lib/site-packages/sentry_sdk/crons/__pycache__/decorator.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/crons/__pycache__/utils.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/crons/decorator.py +2 -0
- package/python/Lib/site-packages/sentry_sdk/crons/utils.py +26 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/__pycache__/arq.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/__pycache__/gql.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/__pycache__/huggingface_hub.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/__pycache__/starlette.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/__pycache__/trytond.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/arq.py +9 -16
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/__init__.py +2 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/__pycache__/__init__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/__pycache__/_client.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/__pycache__/_instrumentation.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/_client.py +13 -15
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/_instrumentation.py +11 -13
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/_services/__pycache__/base.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/_services/__pycache__/bedrock.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/_services/base.py +16 -7
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/_services/bedrock.py +771 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/celery/__init__.py +3 -2
- package/python/Lib/site-packages/sentry_sdk/integrations/celery/__pycache__/__init__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/django/__init__.py +1 -1
- package/python/Lib/site-packages/sentry_sdk/integrations/django/__pycache__/__init__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/django/__pycache__/signals_handlers.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/django/signals_handlers.py +1 -1
- package/python/Lib/site-packages/sentry_sdk/integrations/gql.py +28 -3
- package/python/Lib/site-packages/sentry_sdk/integrations/huggingface_hub.py +1 -1
- package/python/Lib/site-packages/sentry_sdk/integrations/openai_agents/__init__.py +1 -1
- package/python/Lib/site-packages/sentry_sdk/integrations/openai_agents/__pycache__/__init__.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/starlette.py +2 -2
- package/python/Lib/site-packages/sentry_sdk/integrations/trytond.py +1 -1
- package/python/Lib/site-packages/sentry_sdk/profiler/__pycache__/continuous_profiler.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/profiler/__pycache__/transaction_profiler.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/profiler/continuous_profiler.py +0 -3
- package/python/Lib/site-packages/sentry_sdk/profiler/transaction_profiler.py +1 -1
- package/python/Lib/site-packages/sentry_sdk/traces.py +1 -1
- package/python/Lib/site-packages/sentry_sdk/utils.py +17 -4
- package/python/Lib/site-packages/{sentry_sdk-2.74.0.dist-info → sentry_sdk-2.75.0.dist-info}/METADATA +1 -1
- package/python/Lib/site-packages/{sentry_sdk-2.74.0.dist-info → sentry_sdk-2.75.0.dist-info}/RECORD +31 -31
- package/python/Lib/site-packages/tqdm-4.70.1.dist-info/RECORD +1 -1
- package/python/Lib/site-packages/typer-0.29.1.dist-info/RECORD +1 -1
- package/python/Lib/venv/scripts/nt/python.exe +0 -0
- package/python/Lib/venv/scripts/nt/pythonw.exe +0 -0
- package/python/Scripts/conda.exe +0 -0
- package/python/libs/_asyncio.lib +0 -0
- package/python/libs/_bz2.lib +0 -0
- package/python/libs/_ctypes.lib +0 -0
- package/python/libs/_ctypes_test.lib +0 -0
- package/python/libs/_decimal.lib +0 -0
- package/python/libs/_elementtree.lib +0 -0
- package/python/libs/_hashlib.lib +0 -0
- package/python/libs/_lzma.lib +0 -0
- package/python/libs/_msi.lib +0 -0
- package/python/libs/_multiprocessing.lib +0 -0
- package/python/libs/_overlapped.lib +0 -0
- package/python/libs/_queue.lib +0 -0
- package/python/libs/_socket.lib +0 -0
- package/python/libs/_sqlite3.lib +0 -0
- package/python/libs/_ssl.lib +0 -0
- package/python/libs/_testbuffer.lib +0 -0
- package/python/libs/_testcapi.lib +0 -0
- package/python/libs/_testconsole.lib +0 -0
- package/python/libs/_testimportmultiple.lib +0 -0
- package/python/libs/_testinternalcapi.lib +0 -0
- package/python/libs/_testmultiphase.lib +0 -0
- package/python/libs/_tkinter.lib +0 -0
- package/python/libs/_uuid.lib +0 -0
- package/python/libs/_zoneinfo.lib +0 -0
- package/python/libs/pyexpat.lib +0 -0
- package/python/libs/python3.lib +0 -0
- package/python/libs/python311.lib +0 -0
- package/python/libs/select.lib +0 -0
- package/python/libs/sqlite3.lib +0 -0
- package/python/libs/unicodedata.lib +0 -0
- package/python/libs/winsound.lib +0 -0
- package/python/python.exe +0 -0
- package/python/python3.dll +0 -0
- package/python/python311.dll +0 -0
- package/python/pythonw.exe +0 -0
- package/python/Lib/site-packages/platformdirs-4.14.5.dist-info/RECORD +0 -20
- package/python/Lib/site-packages/semver-3.1.1.dist-info/RECORD +0 -17
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/_services/__pycache__/registry.cpython-311.pyc +0 -0
- package/python/Lib/site-packages/sentry_sdk/integrations/boto3/_services/registry.py +0 -22
- /package/python/Lib/site-packages/{platformdirs-4.14.5.dist-info → platformdirs-4.14.7.dist-info}/INSTALLER +0 -0
- /package/python/Lib/site-packages/{platformdirs-4.14.5.dist-info → platformdirs-4.14.7.dist-info}/REQUESTED +0 -0
- /package/python/Lib/site-packages/{platformdirs-4.14.5.dist-info → platformdirs-4.14.7.dist-info}/entry_points.txt +0 -0
- /package/python/Lib/site-packages/{platformdirs-4.14.5.dist-info → platformdirs-4.14.7.dist-info}/licenses/LICENSE +0 -0
- /package/python/Lib/site-packages/{pydantic_settings-2.16.2.dist-info → pydantic_settings-2.16.3.dist-info}/INSTALLER +0 -0
- /package/python/Lib/site-packages/{pydantic_settings-2.16.2.dist-info → pydantic_settings-2.16.3.dist-info}/REQUESTED +0 -0
- /package/python/Lib/site-packages/{platformdirs-4.14.5.dist-info → pydantic_settings-2.16.3.dist-info}/WHEEL +0 -0
- /package/python/Lib/site-packages/{pydantic_settings-2.16.2.dist-info → pydantic_settings-2.16.3.dist-info}/licenses/LICENSE +0 -0
- /package/python/Lib/site-packages/{semver-3.1.1.dist-info → semver-3.1.2.dist-info}/INSTALLER +0 -0
- /package/python/Lib/site-packages/{semver-3.1.1.dist-info → semver-3.1.2.dist-info}/REQUESTED +0 -0
- /package/python/Lib/site-packages/{semver-3.1.1.dist-info → semver-3.1.2.dist-info}/WHEEL +0 -0
- /package/python/Lib/site-packages/{semver-3.1.1.dist-info → semver-3.1.2.dist-info}/entry_points.txt +0 -0
- /package/python/Lib/site-packages/{semver-3.1.1.dist-info → semver-3.1.2.dist-info}/licenses/LICENSE.txt +0 -0
- /package/python/Lib/site-packages/{semver-3.1.1.dist-info → semver-3.1.2.dist-info}/top_level.txt +0 -0
- /package/python/Lib/site-packages/{sentry_sdk-2.74.0.dist-info → sentry_sdk-2.75.0.dist-info}/INSTALLER +0 -0
- /package/python/Lib/site-packages/{sentry_sdk-2.74.0.dist-info → sentry_sdk-2.75.0.dist-info}/REQUESTED +0 -0
- /package/python/Lib/site-packages/{sentry_sdk-2.74.0.dist-info → sentry_sdk-2.75.0.dist-info}/WHEEL +0 -0
- /package/python/Lib/site-packages/{sentry_sdk-2.74.0.dist-info → sentry_sdk-2.75.0.dist-info}/entry_points.txt +0 -0
- /package/python/Lib/site-packages/{sentry_sdk-2.74.0.dist-info → sentry_sdk-2.75.0.dist-info}/licenses/LICENSE +0 -0
- /package/python/Lib/site-packages/{sentry_sdk-2.74.0.dist-info → sentry_sdk-2.75.0.dist-info}/top_level.txt +0 -0
|
@@ -1,24 +1,131 @@
|
|
|
1
|
-
"""List, add, and remove configured conda channels."""
|
|
1
|
+
"""List, resolve, add, and remove configured conda channels."""
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import logging
|
|
4
|
+
from collections.abc import Iterator
|
|
5
|
+
|
|
6
|
+
from conda.base.constants import UNKNOWN_CHANNEL
|
|
7
|
+
from conda.common.path import is_path
|
|
8
|
+
from conda.common.url import has_scheme, remove_auth, split_anaconda_token
|
|
9
|
+
from conda.models.channel import Channel, MultiChannel
|
|
4
10
|
|
|
5
11
|
from anaconda_desktop_bridge.conda.context import conda_context
|
|
6
12
|
from anaconda_desktop_bridge.conda.operations.config_add import config_add
|
|
7
13
|
from anaconda_desktop_bridge.conda.operations.config_remove import config_remove
|
|
14
|
+
from anaconda_desktop_bridge.errors import ValidationError
|
|
8
15
|
from anaconda_desktop_bridge.models.conda_tools import (
|
|
9
16
|
ChannelMetadata,
|
|
10
17
|
ChannelMutationResult,
|
|
18
|
+
ResolvedChannel,
|
|
11
19
|
)
|
|
12
20
|
from anaconda_desktop_bridge.models.context import ContextConfig
|
|
13
21
|
|
|
22
|
+
logger = logging.getLogger(__name__)
|
|
23
|
+
|
|
14
24
|
# The condarc key that holds the channel list.
|
|
15
25
|
CHANNELS_KEY = "channels"
|
|
16
26
|
|
|
17
27
|
|
|
28
|
+
def _without_tokens(value: str) -> str:
|
|
29
|
+
"""Remove every anaconda.org ``/t/<token>`` segment from ``value``.
|
|
30
|
+
|
|
31
|
+
``split_anaconda_token`` drops one segment per call. A URL can carry the
|
|
32
|
+
token conda read as *the* channel token plus another ``/t/<token>`` that
|
|
33
|
+
ended up in the channel name, so repeat until none is left.
|
|
34
|
+
"""
|
|
35
|
+
while True:
|
|
36
|
+
without_token, token = split_anaconda_token(value)
|
|
37
|
+
if not token:
|
|
38
|
+
# No token found. Keep the value as-is: the helper also strips a
|
|
39
|
+
# bare ``/t/`` whose remainder is not a token (e.g. ``/t/<TOKEN>``).
|
|
40
|
+
return value
|
|
41
|
+
value = without_token
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def _mask_tokens(value: str) -> str:
|
|
45
|
+
"""Mask every ``/t/<token>`` segment as ``/t/<TOKEN>/``.
|
|
46
|
+
|
|
47
|
+
``split_anaconda_token`` reports one token at a time, and the placeholder no
|
|
48
|
+
longer matches the token pattern, so scan the tail after each placeholder to
|
|
49
|
+
mask the rest. Unlike :func:`_without_tokens` this keeps the URL shape, which
|
|
50
|
+
is what the echoed ``channel`` reports.
|
|
51
|
+
"""
|
|
52
|
+
head = ""
|
|
53
|
+
tail = value
|
|
54
|
+
while True:
|
|
55
|
+
_cleaned, token = split_anaconda_token(tail)
|
|
56
|
+
if not token:
|
|
57
|
+
return head + tail
|
|
58
|
+
start = tail.find(f"/t/{token}")
|
|
59
|
+
if start < 0: # pragma: no cover - split_anaconda_token just found it
|
|
60
|
+
return head + tail
|
|
61
|
+
head += f"{tail[:start]}/t/<TOKEN>"
|
|
62
|
+
tail = tail[start + len("/t/") + len(token):]
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def _without_userinfo(value: str) -> str:
|
|
66
|
+
"""Drop ``user:pass@`` from a URL; a bare channel name is left alone.
|
|
67
|
+
|
|
68
|
+
``remove_auth`` only parses userinfo out of a value that has a scheme, which
|
|
69
|
+
is all this needs: a scheme-less value is a channel name.
|
|
70
|
+
"""
|
|
71
|
+
return remove_auth(value) if has_scheme(value) else value
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def _redact(value: str, *, mask_token: bool) -> str:
|
|
75
|
+
"""Strip credentials from a channel string or URL for output."""
|
|
76
|
+
without_token = _mask_tokens(value) if mask_token else _without_tokens(value)
|
|
77
|
+
return _without_userinfo(without_token)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def _normalize_base_url(url: str) -> str:
|
|
81
|
+
"""Return ``url`` without an anaconda.org ``/t/<token>`` segment, ``user:pass@``
|
|
82
|
+
auth, or trailing slash.
|
|
83
|
+
|
|
84
|
+
conda's ``Channel.base_url`` already leaves the token and auth out when it
|
|
85
|
+
parsed them; running conda's own helpers again keeps both sides of the
|
|
86
|
+
comparison normalised identically whatever the input looked like.
|
|
87
|
+
"""
|
|
88
|
+
return _redact(url, mask_token=False).rstrip("/")
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def _base_urls(channel: Channel) -> list[str]:
|
|
92
|
+
"""One normalised base URL per member channel, in order, without duplicates.
|
|
93
|
+
|
|
94
|
+
``base_urls`` is public on both ``Channel`` (a 1-tuple) and ``MultiChannel``
|
|
95
|
+
(one per member channel). ``None`` entries (the unknown channel) are dropped.
|
|
96
|
+
"""
|
|
97
|
+
normalized = (_normalize_base_url(url) for url in channel.base_urls if url)
|
|
98
|
+
return list(dict.fromkeys(normalized))
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def _is_credential_shaped(value: str) -> bool:
|
|
102
|
+
"""True for a scheme-less ``user:pass@host`` value.
|
|
103
|
+
|
|
104
|
+
conda reads such a value as a channel *name* on the default alias, so the
|
|
105
|
+
password would come back in ``name``, ``base_urls`` and ``urls`` instead of
|
|
106
|
+
being parsed as userinfo. ``is_path`` keeps local paths (which may contain
|
|
107
|
+
``@``) out of this.
|
|
108
|
+
"""
|
|
109
|
+
if has_scheme(value) or is_path(value):
|
|
110
|
+
return False
|
|
111
|
+
head, separator, rest = value.partition("@")
|
|
112
|
+
if not (separator and rest) or ":" not in head:
|
|
113
|
+
return False
|
|
114
|
+
return "/" not in head and "\\" not in head
|
|
115
|
+
|
|
116
|
+
|
|
18
117
|
def _channel_metadata(channel) -> ChannelMetadata:
|
|
19
118
|
"""Build channel metadata from a conda Channel or channel string."""
|
|
20
|
-
parsed =
|
|
21
|
-
|
|
119
|
+
parsed = (
|
|
120
|
+
channel
|
|
121
|
+
if isinstance(channel, Channel)
|
|
122
|
+
else Channel.from_value(_without_tokens(channel))
|
|
123
|
+
)
|
|
124
|
+
return ChannelMetadata(
|
|
125
|
+
name=_redact(parsed.canonical_name, mask_token=False),
|
|
126
|
+
urls=[_redact(url, mask_token=False) for url in parsed.urls()],
|
|
127
|
+
base_urls=_base_urls(parsed),
|
|
128
|
+
)
|
|
22
129
|
|
|
23
130
|
|
|
24
131
|
def _configured_channels(content: dict) -> list[str]:
|
|
@@ -27,12 +134,97 @@ def _configured_channels(content: dict) -> list[str]:
|
|
|
27
134
|
return list(channels) if isinstance(channels, list) else []
|
|
28
135
|
|
|
29
136
|
|
|
137
|
+
def _parsed_context_channels(context) -> Iterator[Channel]:
|
|
138
|
+
"""Yield ``context.channels`` as conda Channels, skipping unparseable entries.
|
|
139
|
+
|
|
140
|
+
Tokens are dropped before parsing, for the same reason as in
|
|
141
|
+
:func:`resolve_channel`: a leftover ``/t/<token>`` would otherwise come back
|
|
142
|
+
in ``canonical_name``, which ``configured_by`` reports. The skipped value is
|
|
143
|
+
never logged: a condarc entry may carry a token.
|
|
144
|
+
"""
|
|
145
|
+
for index, value in enumerate(context.channels):
|
|
146
|
+
try:
|
|
147
|
+
yield Channel.from_value(_without_tokens(value))
|
|
148
|
+
except Exception: # noqa: BLE001 - one bad entry must not hide the rest
|
|
149
|
+
logger.warning("Skipping configured channel #%d: conda could not parse it", index)
|
|
150
|
+
|
|
151
|
+
|
|
30
152
|
def list_channels(config: ContextConfig | None = None) -> list[ChannelMetadata]:
|
|
31
153
|
"""Return the channels configured in the active conda context."""
|
|
32
154
|
with conda_context(config) as context:
|
|
33
155
|
return [_channel_metadata(channel) for channel in context.channels]
|
|
34
156
|
|
|
35
157
|
|
|
158
|
+
def resolve_channel(channel: str, config: ContextConfig | None = None) -> ResolvedChannel:
|
|
159
|
+
"""Resolve ``channel`` with conda's channel model and check if it is configured.
|
|
160
|
+
|
|
161
|
+
Read-only and offline: nothing is fetched and no condarc is written. All
|
|
162
|
+
resolution runs inside :func:`conda_context`, so ``channel_alias``,
|
|
163
|
+
``custom_channels``, ``custom_multichannels`` and ``default_channels`` from
|
|
164
|
+
the condarc files apply exactly as they do for conda itself.
|
|
165
|
+
|
|
166
|
+
The requested channel is *configured* when every one of its base URLs is a
|
|
167
|
+
base URL of some channel in ``context.channels``. For a multichannel such as
|
|
168
|
+
``defaults`` that means every member must be covered. ``configured_by``
|
|
169
|
+
lists, in configured order, the canonical name of each configured channel
|
|
170
|
+
that provides at least one of the requested base URLs.
|
|
171
|
+
|
|
172
|
+
Raises:
|
|
173
|
+
ValidationError: the value is empty, conda cannot parse it, it names
|
|
174
|
+
conda's "unknown" channel, or it carries ``user:pass@`` without a
|
|
175
|
+
URL scheme. The message never contains the value, which may carry
|
|
176
|
+
credentials (and channel names must stay out of telemetry,
|
|
177
|
+
DESK-3110).
|
|
178
|
+
"""
|
|
179
|
+
value = channel.strip()
|
|
180
|
+
if not value:
|
|
181
|
+
raise ValidationError("Channel must not be empty")
|
|
182
|
+
if _is_credential_shaped(value):
|
|
183
|
+
# conda would read this as a channel name and echo the password back in
|
|
184
|
+
# every URL, so reject it rather than leak it.
|
|
185
|
+
raise ValidationError("Channel credentials must be given in a URL with a scheme")
|
|
186
|
+
|
|
187
|
+
with conda_context(config) as context:
|
|
188
|
+
try:
|
|
189
|
+
# A token is not part of a channel's identity: conda drops it from
|
|
190
|
+
# base_url and canonical_name anyway. Resolve the token-free value so
|
|
191
|
+
# a URL with more than one /t/<token> segment (conda keeps the extra
|
|
192
|
+
# one in the name) cannot put a token back into the result.
|
|
193
|
+
parsed = Channel.from_value(_without_tokens(value))
|
|
194
|
+
if parsed.canonical_name == UNKNOWN_CHANNEL:
|
|
195
|
+
raise ValueError("unknown channel")
|
|
196
|
+
name = _redact(parsed.canonical_name, mask_token=False)
|
|
197
|
+
base_urls = _base_urls(parsed)
|
|
198
|
+
urls = [_redact(url, mask_token=False) for url in parsed.urls()]
|
|
199
|
+
except Exception as error: # noqa: BLE001 - conda raises assorted types
|
|
200
|
+
raise ValidationError("conda could not resolve the requested channel") from error
|
|
201
|
+
|
|
202
|
+
covered: set[str] = set()
|
|
203
|
+
configured_by: list[str] = []
|
|
204
|
+
for configured_channel in _parsed_context_channels(context):
|
|
205
|
+
provided = set(_base_urls(configured_channel)).intersection(base_urls)
|
|
206
|
+
if not provided:
|
|
207
|
+
continue
|
|
208
|
+
covered.update(provided)
|
|
209
|
+
configured_name = _redact(
|
|
210
|
+
configured_channel.canonical_name, mask_token=False
|
|
211
|
+
)
|
|
212
|
+
if configured_name not in configured_by:
|
|
213
|
+
configured_by.append(configured_name)
|
|
214
|
+
|
|
215
|
+
return ResolvedChannel(
|
|
216
|
+
channel=_redact(value, mask_token=True),
|
|
217
|
+
name=name,
|
|
218
|
+
is_multichannel=isinstance(parsed, MultiChannel),
|
|
219
|
+
base_urls=base_urls,
|
|
220
|
+
urls=urls,
|
|
221
|
+
# An empty multichannel (e.g. ``local`` with nothing built) is not
|
|
222
|
+
# "covered" just because there is nothing to cover.
|
|
223
|
+
configured=bool(base_urls) and covered.issuperset(base_urls),
|
|
224
|
+
configured_by=configured_by,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
|
|
36
228
|
def add_channel(
|
|
37
229
|
channel: str,
|
|
38
230
|
*,
|
|
@@ -128,7 +128,14 @@ def _ensure_fresh(subdir_data, fetcher) -> Path | None:
|
|
|
128
128
|
return fetcher.cache_path_json
|
|
129
129
|
path, _state = fetcher.fetch_latest_path()
|
|
130
130
|
return path if path.exists() else None
|
|
131
|
-
except Exception:
|
|
131
|
+
except Exception as error:
|
|
132
|
+
# A repo.anaconda.cloud refusal fails the operation (auth:not-signed-in /
|
|
133
|
+
# auth:access-denied)
|
|
134
|
+
# rather than silently dropping the channel from the results.
|
|
135
|
+
from anaconda_desktop_bridge.conda import repo_credentials
|
|
136
|
+
|
|
137
|
+
if repo_credentials.auth_failure(error) is not None:
|
|
138
|
+
raise
|
|
132
139
|
logger.exception("Failed to fetch repodata for %s", subdir_data.url_w_subdir)
|
|
133
140
|
return None
|
|
134
141
|
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"""Per-operation record of the credential sent to ``repo.anaconda.cloud``.
|
|
2
|
+
|
|
3
|
+
The bridge's conda auth handler (:mod:`anaconda_desktop_bridge.conda.auth_handler`)
|
|
4
|
+
chooses a credential for every request to ``repo.anaconda.cloud`` and reports
|
|
5
|
+
the choice here with :func:`record`; a 401/403 answer is reported with
|
|
6
|
+
:func:`record_auth_failure`. One bridge operation (one
|
|
7
|
+
:func:`~anaconda_desktop_bridge.conda.lock.run_exclusive` call) is one
|
|
8
|
+
:func:`operation_scope`, so callers can tell which credential an operation used
|
|
9
|
+
and why it was refused:
|
|
10
|
+
|
|
11
|
+
- ``bridge.policy.credential`` telemetry (#78) is emitted once per operation
|
|
12
|
+
that touched ``repo.anaconda.cloud``;
|
|
13
|
+
- solve-failure details (``credential``) read :func:`current_operation` while
|
|
14
|
+
the operation is still running;
|
|
15
|
+
- a refused request becomes ``reason: not_signed_in`` / ``access_denied`` on
|
|
16
|
+
transaction results, or an ``auth:not-signed-in`` / ``auth:access-denied``
|
|
17
|
+
error for RPCs that raise (:func:`auth_failure`,
|
|
18
|
+
:meth:`AuthFailure.to_bridge_error`).
|
|
19
|
+
|
|
20
|
+
**API keys only.** The bridge sends the signed-in user's API key, or nothing
|
|
21
|
+
when none is stored; never a repo token, and never a retry with another
|
|
22
|
+
credential.
|
|
23
|
+
|
|
24
|
+
conda issues requests from its own worker threads (parallel repodata fetches
|
|
25
|
+
and package downloads), so the active operation is process-wide rather than
|
|
26
|
+
thread- or context-local. That is safe because ``run_exclusive`` already
|
|
27
|
+
serializes every conda operation in the process.
|
|
28
|
+
|
|
29
|
+
Each scope also bumps :func:`generation`. The auth handler caches the API key
|
|
30
|
+
per generation, so a sign-in, sign-out or key change applies to the next
|
|
31
|
+
operation without restarting the bridge, while the keyring is read at most
|
|
32
|
+
once per operation.
|
|
33
|
+
|
|
34
|
+
Org names are recorded for in-process use and result details only (logs at
|
|
35
|
+
DEBUG). Telemetry must not export them (#78 allowlists ``org_id`` UUIDs only).
|
|
36
|
+
|
|
37
|
+
Stdlib only: importable before conda and anaconda-auth.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
from __future__ import annotations
|
|
41
|
+
|
|
42
|
+
import logging
|
|
43
|
+
import threading
|
|
44
|
+
from collections.abc import Iterator
|
|
45
|
+
from contextlib import contextmanager
|
|
46
|
+
from dataclasses import dataclass, field
|
|
47
|
+
from typing import TYPE_CHECKING
|
|
48
|
+
|
|
49
|
+
if TYPE_CHECKING:
|
|
50
|
+
from anaconda_desktop_bridge.errors import BridgeError
|
|
51
|
+
|
|
52
|
+
logger = logging.getLogger(__name__)
|
|
53
|
+
|
|
54
|
+
# Credential kinds, named as the ``credential`` telemetry attribute values (#78).
|
|
55
|
+
API_KEY = "api_key"
|
|
56
|
+
NONE = "none"
|
|
57
|
+
|
|
58
|
+
# Where a credential came from.
|
|
59
|
+
SOURCE_KEYRING = "keyring" # anaconda-auth keyring (``TokenInfo.api_key``)
|
|
60
|
+
SOURCE_ENV = "env" # ``ANACONDA_AUTH_API_KEY``
|
|
61
|
+
|
|
62
|
+
# ``reason`` of a transaction result refused by repo.anaconda.cloud.
|
|
63
|
+
NOT_SIGNED_IN = "not_signed_in" # no API key is stored, so none was sent
|
|
64
|
+
ACCESS_DENIED = "access_denied" # the API key was sent and refused
|
|
65
|
+
|
|
66
|
+
# Worst first: an operation is summarized by the weakest credential it sent.
|
|
67
|
+
_SEVERITY = {NONE: 0, API_KEY: 1}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass(frozen=True)
|
|
71
|
+
class CredentialChoice:
|
|
72
|
+
"""The credential the auth handler chose for one ``repo.anaconda.cloud`` URL."""
|
|
73
|
+
|
|
74
|
+
credential: str
|
|
75
|
+
org: str | None = None
|
|
76
|
+
source: str | None = None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass(frozen=True)
|
|
80
|
+
class AuthFailure:
|
|
81
|
+
"""A 401/403 answer from ``repo.anaconda.cloud``.
|
|
82
|
+
|
|
83
|
+
``credential`` is what the request carried: ``none`` (not signed in) or
|
|
84
|
+
``api_key`` (sent and refused: expired or revoked, or the account has no
|
|
85
|
+
access to the channel). ``channel`` has any ``/t/<token>`` masked.
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
channel: str | None
|
|
89
|
+
org: str | None
|
|
90
|
+
status: int
|
|
91
|
+
credential: str
|
|
92
|
+
|
|
93
|
+
@property
|
|
94
|
+
def reason(self) -> str:
|
|
95
|
+
"""``not_signed_in`` or ``access_denied``."""
|
|
96
|
+
return NOT_SIGNED_IN if self.credential == NONE else ACCESS_DENIED
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def message(self) -> str:
|
|
100
|
+
where = self.channel or "repo.anaconda.cloud"
|
|
101
|
+
if self.credential == NONE:
|
|
102
|
+
return f"Sign in to Anaconda to use {where}."
|
|
103
|
+
owner = f"organization '{self.org}'" if self.org else "this channel"
|
|
104
|
+
return (
|
|
105
|
+
f"{where} refused your Anaconda sign-in (HTTP {self.status}). Sign in again; "
|
|
106
|
+
f"if it keeps happening, your account may not have access to {owner}."
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
@property
|
|
110
|
+
def details(self) -> dict:
|
|
111
|
+
"""``{org, channel, status}``, without unknown values."""
|
|
112
|
+
details: dict = {"status": self.status}
|
|
113
|
+
if self.org:
|
|
114
|
+
details["org"] = self.org
|
|
115
|
+
if self.channel:
|
|
116
|
+
details["channel"] = self.channel
|
|
117
|
+
return details
|
|
118
|
+
|
|
119
|
+
def to_bridge_error(self) -> BridgeError:
|
|
120
|
+
"""The domain error for an RPC that raises instead of returning a result."""
|
|
121
|
+
from anaconda_desktop_bridge.errors import AccessDeniedError, NotSignedInError
|
|
122
|
+
|
|
123
|
+
error_cls = NotSignedInError if self.credential == NONE else AccessDeniedError
|
|
124
|
+
return error_cls(self.message, details=self.details)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@dataclass
|
|
128
|
+
class OperationCredentials:
|
|
129
|
+
"""Credentials used by one bridge operation, deduplicated, in first-use order."""
|
|
130
|
+
|
|
131
|
+
name: str
|
|
132
|
+
choices: list[CredentialChoice] = field(default_factory=list)
|
|
133
|
+
auth_failures: list[AuthFailure] = field(default_factory=list)
|
|
134
|
+
|
|
135
|
+
@property
|
|
136
|
+
def touched(self) -> bool:
|
|
137
|
+
"""True once any request to ``repo.anaconda.cloud`` was authenticated."""
|
|
138
|
+
return bool(self.choices)
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def credential(self) -> str | None:
|
|
142
|
+
"""Weakest credential used (``none`` < ``api_key``)."""
|
|
143
|
+
if not self.choices:
|
|
144
|
+
return None
|
|
145
|
+
return min((c.credential for c in self.choices), key=_SEVERITY.__getitem__)
|
|
146
|
+
|
|
147
|
+
@property
|
|
148
|
+
def org(self) -> str | None:
|
|
149
|
+
"""First org named by a channel URL the operation sent a request to."""
|
|
150
|
+
return next((c.org for c in self.choices if c.org), None)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
_lock = threading.Lock()
|
|
154
|
+
_active: OperationCredentials | None = None
|
|
155
|
+
_generation = 0
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
def generation() -> int:
|
|
159
|
+
"""Counter bumped by every :func:`operation_scope`; keys the handler's cache."""
|
|
160
|
+
return _generation
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def current_operation() -> OperationCredentials | None:
|
|
164
|
+
"""The running operation's record, or None outside :func:`operation_scope`."""
|
|
165
|
+
return _active
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
def record(choice: CredentialChoice) -> None:
|
|
169
|
+
"""Add ``choice`` to the running operation. A no-op outside a scope."""
|
|
170
|
+
with _lock:
|
|
171
|
+
if _active is not None and choice not in _active.choices:
|
|
172
|
+
_active.choices.append(choice)
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def record_auth_failure(failure: AuthFailure) -> None:
|
|
176
|
+
"""Add a refused request to the running operation. A no-op outside a scope."""
|
|
177
|
+
with _lock:
|
|
178
|
+
if _active is not None and failure not in _active.auth_failures:
|
|
179
|
+
_active.auth_failures.append(failure)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
def auth_failure(error: BaseException | None = None) -> AuthFailure | None:
|
|
183
|
+
"""The ``repo.anaconda.cloud`` refusal behind ``error``, if any.
|
|
184
|
+
|
|
185
|
+
Looks at ``error`` and its causes first (the auth handler's error carries
|
|
186
|
+
the failure as ``repo_auth_failure``), then at the running operation's
|
|
187
|
+
record, since conda may wrap or replace the exception (e.g. a
|
|
188
|
+
``CondaMultiError`` from parallel downloads).
|
|
189
|
+
"""
|
|
190
|
+
seen: set[int] = set()
|
|
191
|
+
current = error
|
|
192
|
+
while current is not None and id(current) not in seen:
|
|
193
|
+
seen.add(id(current))
|
|
194
|
+
failure = getattr(current, "repo_auth_failure", None)
|
|
195
|
+
if isinstance(failure, AuthFailure):
|
|
196
|
+
return failure
|
|
197
|
+
current = current.__cause__ or current.__context__
|
|
198
|
+
operation = _active
|
|
199
|
+
if operation is not None and operation.auth_failures:
|
|
200
|
+
return operation.auth_failures[0]
|
|
201
|
+
return None
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
@contextmanager
|
|
205
|
+
def operation_scope(name: str) -> Iterator[OperationCredentials]:
|
|
206
|
+
"""Track the credentials used while the body runs, as one operation."""
|
|
207
|
+
global _active, _generation
|
|
208
|
+
operation = OperationCredentials(name=name)
|
|
209
|
+
with _lock:
|
|
210
|
+
_generation += 1
|
|
211
|
+
previous, _active = _active, operation
|
|
212
|
+
try:
|
|
213
|
+
yield operation
|
|
214
|
+
finally:
|
|
215
|
+
with _lock:
|
|
216
|
+
_active = previous
|
|
217
|
+
if operation.touched:
|
|
218
|
+
logger.info(
|
|
219
|
+
"%s: repo.anaconda.cloud credential=%s refused=%d",
|
|
220
|
+
name,
|
|
221
|
+
operation.credential,
|
|
222
|
+
len(operation.auth_failures),
|
|
223
|
+
)
|
|
224
|
+
logger.debug("%s: repo.anaconda.cloud credential choices: %s", name, operation.choices)
|
|
Binary file
|
|
@@ -12,6 +12,7 @@ from conda.cli.install import check_prefix, validate_install_command
|
|
|
12
12
|
from conda.core.prefix_data import PrefixData
|
|
13
13
|
from conda.models.match_spec import MatchSpec
|
|
14
14
|
|
|
15
|
+
from anaconda_desktop_bridge.conda import repo_credentials
|
|
15
16
|
from anaconda_desktop_bridge.conda.operations.environments import (
|
|
16
17
|
find_known_environments_by_name,
|
|
17
18
|
)
|
|
@@ -92,6 +93,16 @@ def _classify_solver_error(
|
|
|
92
93
|
},
|
|
93
94
|
)
|
|
94
95
|
|
|
96
|
+
# repo.anaconda.cloud refused a request: not signed in, or the API key was
|
|
97
|
+
# refused. Checked before message matching, which would fold it into a
|
|
98
|
+
# generic solve_failed.
|
|
99
|
+
if (failure := repo_credentials.auth_failure(error)) is not None:
|
|
100
|
+
return SolverErrorInfo(
|
|
101
|
+
reason=failure.reason,
|
|
102
|
+
message=failure.message,
|
|
103
|
+
details=failure.details,
|
|
104
|
+
)
|
|
105
|
+
|
|
95
106
|
error_str = str(error)
|
|
96
107
|
error_cls_name = type(error).__name__
|
|
97
108
|
|
|
@@ -197,6 +208,18 @@ def _classify_execute_error(
|
|
|
197
208
|
},
|
|
198
209
|
},
|
|
199
210
|
)
|
|
211
|
+
# A package download refused by repo.anaconda.cloud (e.g. the user signed
|
|
212
|
+
# out, or the API key was revoked, between solve and execute).
|
|
213
|
+
if (failure := repo_credentials.auth_failure(error)) is not None:
|
|
214
|
+
return TransactionResult(
|
|
215
|
+
prefix=prefix,
|
|
216
|
+
success=False,
|
|
217
|
+
reason=failure.reason,
|
|
218
|
+
dry_run=False,
|
|
219
|
+
transaction_id=transaction_id,
|
|
220
|
+
message=failure.message,
|
|
221
|
+
details=failure.details,
|
|
222
|
+
)
|
|
200
223
|
# User-actionable failures (OSError, PermissionError, CondaError, and
|
|
201
224
|
# notably CondaMultiError on Windows entry-point link verification). Ship
|
|
202
225
|
# str(error) verbatim so the multi-line "package appears to be corrupted"
|
|
@@ -73,6 +73,30 @@ class UnsupportedDomainError(BridgeError):
|
|
|
73
73
|
super().__init__(details=details)
|
|
74
74
|
|
|
75
75
|
|
|
76
|
+
class NotSignedInError(BridgeError):
|
|
77
|
+
"""``repo.anaconda.cloud`` refused a request that carried no credential.
|
|
78
|
+
|
|
79
|
+
The bridge sends the signed-in user's API key to that host, and nothing
|
|
80
|
+
when none is stored. ``details``: ``org`` (when the URL names one),
|
|
81
|
+
``channel``, ``status``.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
domain_code = "auth:not-signed-in"
|
|
85
|
+
message = "Sign in to Anaconda to use this channel"
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class AccessDeniedError(BridgeError):
|
|
89
|
+
"""``repo.anaconda.cloud`` refused the API key that was sent.
|
|
90
|
+
|
|
91
|
+
The key expired or was revoked, or the account has no access to the
|
|
92
|
+
channel. Never retried with another credential. ``details`` as for
|
|
93
|
+
:class:`NotSignedInError`.
|
|
94
|
+
"""
|
|
95
|
+
|
|
96
|
+
domain_code = "auth:access-denied"
|
|
97
|
+
message = "Access to this channel was denied"
|
|
98
|
+
|
|
99
|
+
|
|
76
100
|
class TransactionNotFoundError(BridgeError):
|
|
77
101
|
"""Raised when execute_transaction cannot find a deferred transaction."""
|
|
78
102
|
|
|
Binary file
|
|
@@ -7,6 +7,7 @@ from anaconda_desktop_bridge.models.conda_tools import (
|
|
|
7
7
|
EmptyParams,
|
|
8
8
|
ListChannelsParams,
|
|
9
9
|
RemoveChannelParams,
|
|
10
|
+
ResolveChannelParams,
|
|
10
11
|
)
|
|
11
12
|
from anaconda_desktop_bridge.rpc import method
|
|
12
13
|
|
|
@@ -33,6 +34,13 @@ async def conda_tools_list_channels(params):
|
|
|
33
34
|
return await run_exclusive(conda.list_channels, params.config)
|
|
34
35
|
|
|
35
36
|
|
|
37
|
+
@method("conda_tools.resolve_channel", ResolveChannelParams)
|
|
38
|
+
async def conda_tools_resolve_channel(params):
|
|
39
|
+
# Offline and read-only, but conda_context resets conda's process-global
|
|
40
|
+
# context, so it must hold the conda lock like every other conda call.
|
|
41
|
+
return await run_exclusive(conda.resolve_channel, params.channel, params.config)
|
|
42
|
+
|
|
43
|
+
|
|
36
44
|
@method("conda_tools.add_channel", AddChannelParams)
|
|
37
45
|
async def conda_tools_add_channel(params):
|
|
38
46
|
return await run_exclusive(
|
|
Binary file
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"""Pydantic models for conda_tools JSON-RPC methods."""
|
|
2
2
|
|
|
3
3
|
from pathlib import Path
|
|
4
|
+
from typing import Annotated
|
|
4
5
|
|
|
5
|
-
from pydantic import BaseModel, ConfigDict, Field
|
|
6
|
+
from pydantic import BaseModel, ConfigDict, Field, StringConstraints
|
|
6
7
|
|
|
7
8
|
from anaconda_desktop_bridge.models.context import ContextConfig
|
|
8
9
|
|
|
@@ -54,11 +55,55 @@ class RemoveChannelParams(ContextParams):
|
|
|
54
55
|
location: str | None = "user"
|
|
55
56
|
|
|
56
57
|
|
|
58
|
+
class ResolveChannelParams(ContextParams):
|
|
59
|
+
"""Parameters for conda_tools.resolve_channel."""
|
|
60
|
+
|
|
61
|
+
# A channel name (``conda-forge``), a name with a label/subpath
|
|
62
|
+
# (``conda-forge/label/dev``), a multichannel name (``defaults``), a URL, or
|
|
63
|
+
# a local path / ``file://`` URL. Surrounding whitespace is stripped; an
|
|
64
|
+
# empty or whitespace-only value is rejected.
|
|
65
|
+
channel: Annotated[str, StringConstraints(strip_whitespace=True, min_length=1)]
|
|
66
|
+
|
|
67
|
+
|
|
57
68
|
class ChannelMetadata(BaseModel):
|
|
58
69
|
"""Metadata for a configured conda channel."""
|
|
59
70
|
|
|
60
71
|
name: str
|
|
61
72
|
urls: list[str] = Field(default_factory=list, description="Channel URLs")
|
|
73
|
+
base_urls: list[str] = Field(
|
|
74
|
+
default_factory=list,
|
|
75
|
+
description=(
|
|
76
|
+
"One base URL per member channel: no platform subdir, no credentials, "
|
|
77
|
+
"no trailing slash. Comparable with conda_tools.resolve_channel."
|
|
78
|
+
),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class ResolvedChannel(BaseModel):
|
|
83
|
+
"""Result of conda_tools.resolve_channel."""
|
|
84
|
+
|
|
85
|
+
channel: str = Field(description="The requested channel, stripped (credentials masked)")
|
|
86
|
+
name: str = Field(description="conda's canonical name for the channel")
|
|
87
|
+
is_multichannel: bool = False
|
|
88
|
+
base_urls: list[str] = Field(
|
|
89
|
+
default_factory=list,
|
|
90
|
+
description="One per member channel; no subdir, credentials or trailing slash",
|
|
91
|
+
)
|
|
92
|
+
urls: list[str] = Field(
|
|
93
|
+
default_factory=list,
|
|
94
|
+
description="Per-subdir URLs without credentials (same shape as list_channels)",
|
|
95
|
+
)
|
|
96
|
+
configured: bool = Field(
|
|
97
|
+
default=False,
|
|
98
|
+
description="True only if every base URL is provided by a configured channel",
|
|
99
|
+
)
|
|
100
|
+
configured_by: list[str] = Field(
|
|
101
|
+
default_factory=list,
|
|
102
|
+
description=(
|
|
103
|
+
"Canonical names of the configured channels that provide at least one "
|
|
104
|
+
"of base_urls, in configured order"
|
|
105
|
+
),
|
|
106
|
+
)
|
|
62
107
|
|
|
63
108
|
|
|
64
109
|
class ChannelMutationResult(BaseModel):
|