@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
|
@@ -7,32 +7,27 @@ import posixpath
|
|
|
7
7
|
import re
|
|
8
8
|
import stat
|
|
9
9
|
import sys
|
|
10
|
-
import warnings
|
|
11
10
|
from contextlib import suppress
|
|
12
11
|
from pathlib import Path
|
|
13
12
|
from tempfile import gettempdir
|
|
14
|
-
from typing import TYPE_CHECKING, Final, NoReturn
|
|
15
13
|
|
|
16
|
-
from .
|
|
17
|
-
from .
|
|
14
|
+
from ._runtime import RUNTIME_DIR_MODE as _RUNTIME_DIR_MODE
|
|
15
|
+
from ._runtime import geteuid
|
|
16
|
+
from ._runtime import runtime_dir_problem as _runtime_dir_problem
|
|
17
|
+
from ._runtime import warn_once as _warn_once
|
|
18
|
+
from ._xdg import XDGMixin, expand_user, xdg_dir
|
|
19
|
+
from .api import (
|
|
20
|
+
PlatformDirsABC,
|
|
21
|
+
RuntimeDirWarning, # ruff:ignore[unused-import] # retain module attribute
|
|
22
|
+
)
|
|
18
23
|
|
|
24
|
+
TYPE_CHECKING = False
|
|
19
25
|
if TYPE_CHECKING:
|
|
20
26
|
from collections.abc import Iterator
|
|
27
|
+
from typing import Final
|
|
21
28
|
|
|
22
|
-
if sys.platform == "win32":
|
|
23
|
-
|
|
24
|
-
def geteuid() -> NoReturn:
|
|
25
|
-
msg = "should only be used on Unix"
|
|
26
|
-
raise RuntimeError(msg)
|
|
27
|
-
|
|
28
|
-
else:
|
|
29
|
-
try:
|
|
30
|
-
from os import geteuid
|
|
31
|
-
except ImportError:
|
|
32
|
-
from os import getuid as geteuid
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
class _UnixDefaults(PlatformDirsABC): # ruff:ignore[too-many-public-methods]
|
|
30
|
+
class _UnixDefaults(PlatformDirsABC): # ruff:ignore[too-many-public-methods] # full directory API
|
|
36
31
|
"""Default directories for Unix/Linux without XDG environment variable overrides.
|
|
37
32
|
|
|
38
33
|
The XDG env var handling is in :class:`~platformdirs._xdg.XDGMixin`.
|
|
@@ -45,37 +40,35 @@ class _UnixDefaults(PlatformDirsABC): # ruff:ignore[too-many-public-methods]
|
|
|
45
40
|
|
|
46
41
|
@property
|
|
47
42
|
def user_data_dir(self) -> str:
|
|
48
|
-
"""Data directory tied to the user
|
|
49
|
-
|
|
43
|
+
"""Data directory tied to the user.
|
|
44
|
+
|
|
45
|
+
E.g. ``~/.local/share/$appname/$version`` or ``$XDG_DATA_HOME/$appname/$version``.
|
|
46
|
+
|
|
47
|
+
"""
|
|
48
|
+
return self._append_app_name_and_version(expand_user("~/.local/share"), private=True)
|
|
50
49
|
|
|
51
50
|
@property
|
|
52
51
|
def _site_data_dirs(self) -> list[str]:
|
|
53
52
|
return [self._join_app_name_and_version("/usr/local/share"), self._join_app_name_and_version("/usr/share")]
|
|
54
53
|
|
|
55
|
-
@property
|
|
56
|
-
def user_config_dir(self) -> str:
|
|
57
|
-
"""Config directory tied to the user, e.g. ``~/.config/$appname/$version`` or ``$XDG_CONFIG_HOME/$appname/$version``."""
|
|
58
|
-
return self._append_app_name_and_version(_expand_user("~/.config"), private=True)
|
|
59
|
-
|
|
60
54
|
@property
|
|
61
55
|
def _site_config_dirs(self) -> list[str]:
|
|
62
56
|
return [self._join_app_name_and_version("/etc/xdg")]
|
|
63
57
|
|
|
64
58
|
@property
|
|
65
59
|
def user_cache_dir(self) -> str:
|
|
66
|
-
"""Cache directory tied to the user
|
|
67
|
-
|
|
60
|
+
"""Cache directory tied to the user.
|
|
61
|
+
|
|
62
|
+
E.g. ``~/.cache/$appname/$version`` or ``$XDG_CACHE_HOME/$appname/$version``.
|
|
63
|
+
|
|
64
|
+
"""
|
|
65
|
+
return self._append_app_name_and_version(expand_user("~/.cache"), private=True)
|
|
68
66
|
|
|
69
67
|
@property
|
|
70
68
|
def site_cache_dir(self) -> str:
|
|
71
69
|
"""Cache directory shared by users, e.g. ``/var/cache/$appname/$version``."""
|
|
72
70
|
return self._append_app_name_and_version("/var/cache", private=False)
|
|
73
71
|
|
|
74
|
-
@property
|
|
75
|
-
def user_state_dir(self) -> str:
|
|
76
|
-
"""State directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or ``$XDG_STATE_HOME/$appname/$version``."""
|
|
77
|
-
return self._append_app_name_and_version(_expand_user("~/.local/state"), private=True)
|
|
78
|
-
|
|
79
72
|
@property
|
|
80
73
|
def site_state_dir(self) -> str:
|
|
81
74
|
"""State directory shared by users, e.g. ``/var/lib/$appname/$version``."""
|
|
@@ -86,10 +79,19 @@ class _UnixDefaults(PlatformDirsABC): # ruff:ignore[too-many-public-methods]
|
|
|
86
79
|
"""Log directory tied to the user, same as `user_state_dir` if not opinionated else ``log`` in it."""
|
|
87
80
|
path = self.user_state_dir
|
|
88
81
|
if self.opinion:
|
|
89
|
-
path = os.path.join(path, "log") # ruff:ignore[os-path-join]
|
|
82
|
+
path = os.path.join(path, "log") # ruff:ignore[os-path-join] # preserve path separators
|
|
90
83
|
self._optionally_create_directory(path, private=True)
|
|
91
84
|
return path
|
|
92
85
|
|
|
86
|
+
@property
|
|
87
|
+
def user_state_dir(self) -> str:
|
|
88
|
+
"""State directory tied to the user.
|
|
89
|
+
|
|
90
|
+
E.g. ``~/.local/state/$appname/$version`` or ``$XDG_STATE_HOME/$appname/$version``.
|
|
91
|
+
|
|
92
|
+
"""
|
|
93
|
+
return self._append_app_name_and_version(expand_user("~/.local/state"), private=True)
|
|
94
|
+
|
|
93
95
|
@property
|
|
94
96
|
def site_log_dir(self) -> str:
|
|
95
97
|
"""Log directory shared by users, e.g. ``/var/log/$appname/$version``.
|
|
@@ -104,6 +106,12 @@ class _UnixDefaults(PlatformDirsABC): # ruff:ignore[too-many-public-methods]
|
|
|
104
106
|
"""Documents directory tied to the user, e.g. ``~/Documents``."""
|
|
105
107
|
return self._user_media_dir("XDG_DOCUMENTS_DIR", "~/Documents")
|
|
106
108
|
|
|
109
|
+
def _user_media_dir(self, key: str, default: str) -> str:
|
|
110
|
+
if path := _get_user_dirs_folder(key):
|
|
111
|
+
self._optionally_create_media_directory(path)
|
|
112
|
+
return path
|
|
113
|
+
return expand_user(default)
|
|
114
|
+
|
|
107
115
|
@property
|
|
108
116
|
def user_downloads_dir(self) -> str:
|
|
109
117
|
"""Downloads directory tied to the user, e.g. ``~/Downloads``."""
|
|
@@ -144,26 +152,29 @@ class _UnixDefaults(PlatformDirsABC): # ruff:ignore[too-many-public-methods]
|
|
|
144
152
|
"""Templates directory tied to the user, e.g. ``~/Templates``."""
|
|
145
153
|
return self._user_media_dir("XDG_TEMPLATES_DIR", "~/Templates")
|
|
146
154
|
|
|
147
|
-
def _user_media_dir(self, key: str, default: str) -> str:
|
|
148
|
-
if path := _get_user_dirs_folder(key):
|
|
149
|
-
self._optionally_create_media_directory(path)
|
|
150
|
-
return path
|
|
151
|
-
return _expand_user(default)
|
|
152
|
-
|
|
153
155
|
@property
|
|
154
156
|
def user_fonts_dir(self) -> str:
|
|
155
157
|
"""Fonts directory tied to the user, e.g. ``~/.local/share/fonts``."""
|
|
156
|
-
return f"{
|
|
158
|
+
return f"{expand_user('~/.local/share')}/fonts"
|
|
157
159
|
|
|
158
160
|
@property
|
|
159
161
|
def user_preference_dir(self) -> str:
|
|
160
162
|
"""Preference directory tied to the user, same as ``user_config_dir``."""
|
|
161
163
|
return self.user_config_dir
|
|
162
164
|
|
|
165
|
+
@property
|
|
166
|
+
def user_config_dir(self) -> str:
|
|
167
|
+
"""Config directory tied to the user.
|
|
168
|
+
|
|
169
|
+
E.g. ``~/.config/$appname/$version`` or ``$XDG_CONFIG_HOME/$appname/$version``.
|
|
170
|
+
|
|
171
|
+
"""
|
|
172
|
+
return self._append_app_name_and_version(expand_user("~/.config"), private=True)
|
|
173
|
+
|
|
163
174
|
@property
|
|
164
175
|
def user_bin_dir(self) -> str:
|
|
165
176
|
"""Bin directory tied to the user, e.g. ``~/.local/bin``."""
|
|
166
|
-
return
|
|
177
|
+
return expand_user("~/.local/bin")
|
|
167
178
|
|
|
168
179
|
@property
|
|
169
180
|
def site_bin_dir(self) -> str:
|
|
@@ -173,15 +184,35 @@ class _UnixDefaults(PlatformDirsABC): # ruff:ignore[too-many-public-methods]
|
|
|
173
184
|
@property
|
|
174
185
|
def user_applications_dir(self) -> str:
|
|
175
186
|
"""Applications directory tied to the user, e.g. ``~/.local/share/applications``."""
|
|
176
|
-
return f"{
|
|
187
|
+
return f"{expand_user('~/.local/share')}{os.sep}applications"
|
|
177
188
|
|
|
178
189
|
@property
|
|
179
190
|
def _site_applications_dirs(self) -> list[str]:
|
|
191
|
+
# preserve path separators
|
|
180
192
|
return [os.path.join(p, "applications") for p in ["/usr/local/share", "/usr/share"]] # ruff:ignore[os-path-join]
|
|
181
193
|
|
|
194
|
+
@property
|
|
195
|
+
def site_runtime_dir(self) -> str:
|
|
196
|
+
"""Runtime directory shared by users, e.g. ``/run/$appname/$version`` or ``$XDG_RUNTIME_DIR/$appname/$version``.
|
|
197
|
+
|
|
198
|
+
Note that this behaves almost exactly like `user_runtime_dir` if ``$XDG_RUNTIME_DIR`` is set, but will fall back
|
|
199
|
+
to paths associated to the root user instead of a regular logged-in user if it's not set.
|
|
200
|
+
|
|
201
|
+
If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir`
|
|
202
|
+
instead.
|
|
203
|
+
|
|
204
|
+
For FreeBSD/OpenBSD/NetBSD, it would return ``/var/run/$appname/$version`` if ``$XDG_RUNTIME_DIR`` is not set.
|
|
205
|
+
|
|
206
|
+
"""
|
|
207
|
+
if sys.platform.startswith(("freebsd", "openbsd", "netbsd")):
|
|
208
|
+
path = "/var/run"
|
|
209
|
+
else:
|
|
210
|
+
path = "/run"
|
|
211
|
+
return self._append_app_name_and_version(path, private=False)
|
|
212
|
+
|
|
182
213
|
def _default_runtime_dir(self) -> str:
|
|
183
214
|
if sys.platform.startswith("openbsd"):
|
|
184
|
-
path = f"/tmp/run/user/{geteuid()}" # ruff:ignore[hardcoded-temp-file]
|
|
215
|
+
path = f"/tmp/run/user/{geteuid()}" # ruff:ignore[hardcoded-temp-file] # fixed OpenBSD runtime directory
|
|
185
216
|
elif sys.platform.startswith(("freebsd", "netbsd")):
|
|
186
217
|
path = f"/var/run/user/{geteuid()}"
|
|
187
218
|
else:
|
|
@@ -201,24 +232,49 @@ class _UnixDefaults(PlatformDirsABC): # ruff:ignore[too-many-public-methods]
|
|
|
201
232
|
Path(path).chmod(_RUNTIME_DIR_MODE)
|
|
202
233
|
return path
|
|
203
234
|
|
|
204
|
-
@property
|
|
205
|
-
def site_runtime_dir(self) -> str:
|
|
206
|
-
"""Runtime directory shared by users, e.g. ``/run/$appname/$version`` or ``$XDG_RUNTIME_DIR/$appname/$version``.
|
|
207
235
|
|
|
208
|
-
|
|
209
|
-
|
|
236
|
+
def _get_user_dirs_folder(key: str) -> str | None:
|
|
237
|
+
# Return directory from user-dirs.dirs config file.
|
|
238
|
+
#
|
|
239
|
+
# ``xdg-user-dirs-update`` writes shell assignments, so match each line like ``xdg-user-dir`` does and keep the last
|
|
240
|
+
# valid assignment to ``key``.
|
|
241
|
+
#
|
|
242
|
+
# See https://freedesktop.org/wiki/Software/xdg-user-dirs/.
|
|
243
|
+
user_dirs_config_path = Path(xdg_dir("XDG_CONFIG_HOME") or expand_user("~/.config")) / "user-dirs.dirs"
|
|
244
|
+
folder = None
|
|
245
|
+
try:
|
|
246
|
+
# the file holds raw path bytes, and surrogateescape round-trips undecodable ones like os.fsdecode
|
|
247
|
+
# Split only at LF: a CR inside a quoted Unix path is a literal filename byte, not a line ending.
|
|
248
|
+
with user_dirs_config_path.open(
|
|
249
|
+
encoding=sys.getfilesystemencoding(), errors="surrogateescape", newline="\n"
|
|
250
|
+
) as stream:
|
|
251
|
+
for line in stream:
|
|
252
|
+
# Drop a CR that ends the line but keep the LF, so a backslash before it is not taken as ending the file.
|
|
253
|
+
if (entry := _USER_DIRS_LINE.match(_LINE_END_CR.sub("", line))) and entry["key"] == key:
|
|
254
|
+
folder = _resolve_user_dirs_value(entry) or folder
|
|
255
|
+
except OSError: # a missing or unreadable file leaves the defaults in place
|
|
256
|
+
return None
|
|
257
|
+
return folder
|
|
210
258
|
|
|
211
|
-
If you wish to ensure that a logged-in root user path is returned e.g. ``/run/user/0``, use `user_runtime_dir`
|
|
212
|
-
instead.
|
|
213
259
|
|
|
214
|
-
|
|
260
|
+
def _resolve_user_dirs_value(entry: re.Match[str]) -> str | None:
|
|
261
|
+
value = entry["bare"] if entry["quoted"] is None else entry["quoted"]
|
|
262
|
+
if value == "$HOME" or value.startswith("$HOME/"):
|
|
263
|
+
# A home of / would give "//Desktop", which pathlib keeps as a distinct root.
|
|
264
|
+
prefix, value = expand_user("~").rstrip("/"), value.removeprefix("$HOME")
|
|
265
|
+
elif value.startswith("/"):
|
|
266
|
+
prefix = ""
|
|
267
|
+
else:
|
|
268
|
+
return None
|
|
269
|
+
# xdg-user-dirs-update backslash-escapes $, `, " and \ inside the quotes, and outside them the shell drops the
|
|
270
|
+
# backslash before any character.
|
|
271
|
+
value = (_VALUE_PATTERN if entry["quoted"] is not None else _BARE_VALUE_PATTERN).sub(r"\1", value)
|
|
272
|
+
return f"{prefix}{value}" or "/"
|
|
215
273
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
path = "/run"
|
|
221
|
-
return self._append_app_name_and_version(path, private=False)
|
|
274
|
+
|
|
275
|
+
def _temp_runtime_fallback() -> str:
|
|
276
|
+
# A temporary directory of / would give "//runtime-<uid>", which pathlib keeps as a distinct root.
|
|
277
|
+
return posixpath.join(gettempdir(), f"runtime-{geteuid()}")
|
|
222
278
|
|
|
223
279
|
|
|
224
280
|
class Unix(XDGMixin, _UnixDefaults):
|
|
@@ -281,7 +337,7 @@ class Unix(XDGMixin, _UnixDefaults):
|
|
|
281
337
|
if self._use_site:
|
|
282
338
|
# XDGMixin.site_runtime_dir reads $XDG_RUNTIME_DIR, which belongs to the user who started the root process.
|
|
283
339
|
return super(XDGMixin, self).site_runtime_dir
|
|
284
|
-
if not (path :=
|
|
340
|
+
if not (path := xdg_dir("XDG_RUNTIME_DIR")):
|
|
285
341
|
reason = "XDG_RUNTIME_DIR is not set"
|
|
286
342
|
else:
|
|
287
343
|
# Creating the missing levels follows whatever symlink sits at a parent, so check the parents first.
|
|
@@ -298,25 +354,6 @@ class Unix(XDGMixin, _UnixDefaults):
|
|
|
298
354
|
_warn_once(f"{reason}, falling back to {(fallback := self._default_runtime_dir())}")
|
|
299
355
|
return self._append_app_name_and_version(fallback, private=True)
|
|
300
356
|
|
|
301
|
-
def place_runtime_file(self, name: str | os.PathLike[str]) -> Path:
|
|
302
|
-
"""Like :meth:`~platformdirs.api.PlatformDirsABC.place_runtime_file`.
|
|
303
|
-
|
|
304
|
-
Creates the runtime directory before checking it, so another user cannot create it in between.
|
|
305
|
-
|
|
306
|
-
:raises PermissionError: if the temporary fallback is a symlink, not a directory, owned by another user, or
|
|
307
|
-
missing right after its creation.
|
|
308
|
-
|
|
309
|
-
"""
|
|
310
|
-
|
|
311
|
-
def created(lookup: PlatformDirsABC) -> Path:
|
|
312
|
-
lookup.ensure_exists = True
|
|
313
|
-
return lookup.user_runtime_path
|
|
314
|
-
|
|
315
|
-
return self._place_file(created, name)
|
|
316
|
-
|
|
317
|
-
def _find_runtime_files(self, name: str | os.PathLike[str]) -> Iterator[Path]:
|
|
318
|
-
return filter(_in_own_runtime_dir, super()._find_runtime_files(name))
|
|
319
|
-
|
|
320
357
|
@property
|
|
321
358
|
def user_bin_dir(self) -> str:
|
|
322
359
|
"""Bin directory tied to the user, or site equivalent when root with ``use_site_for_root``."""
|
|
@@ -327,13 +364,6 @@ class Unix(XDGMixin, _UnixDefaults):
|
|
|
327
364
|
"""Fonts directory tied to the user, ignoring ``$XDG_DATA_HOME`` when root with ``use_site_for_root``."""
|
|
328
365
|
return super(XDGMixin, self).user_fonts_dir if self._use_site else super().user_fonts_dir
|
|
329
366
|
|
|
330
|
-
def _xdg_media_dir(self, env_var: str) -> str | None:
|
|
331
|
-
# The XDG_*_DIR variables and user-dirs.dirs belong to the user who started the root process.
|
|
332
|
-
return None if self._use_site else super()._xdg_media_dir(env_var)
|
|
333
|
-
|
|
334
|
-
def _user_media_dir(self, key: str, default: str) -> str:
|
|
335
|
-
return _expand_user(default) if self._use_site else super()._user_media_dir(key, default)
|
|
336
|
-
|
|
337
367
|
@property
|
|
338
368
|
def user_data_path(self) -> Path:
|
|
339
369
|
"""Data path tied to the user, or the first site entry when root with ``use_site_for_root``."""
|
|
@@ -354,95 +384,35 @@ class Unix(XDGMixin, _UnixDefaults):
|
|
|
354
384
|
"""Applications path tied to the user, or the first site entry when root with ``use_site_for_root``."""
|
|
355
385
|
return self.site_applications_path if self._use_site else super().user_applications_path
|
|
356
386
|
|
|
387
|
+
def place_runtime_file(self, name: str | os.PathLike[str]) -> Path:
|
|
388
|
+
"""Like :meth:`~platformdirs.api.PlatformDirsABC.place_runtime_file`.
|
|
357
389
|
|
|
358
|
-
|
|
359
|
-
r"""
|
|
360
|
-
[ \t]*(?P<key>\w+)[ \t]*=[ \t]* # KEY=, blanks allowed around the key and after the =
|
|
361
|
-
(?:
|
|
362
|
-
"(?P<quoted>(?:[^"\\]|\\.)*)" # a double-quoted value with backslash escapes, text after it ignored
|
|
363
|
-
|(?P<bare>[^"\s](?:[^ \t\n]|[ \t]+[^ \t\n\#])*) # or an unquoted value; blanks join it only before a word
|
|
364
|
-
# that starts no comment, and each run is matched once so
|
|
365
|
-
# long runs stay linear
|
|
366
|
-
)
|
|
367
|
-
""",
|
|
368
|
-
re.VERBOSE,
|
|
369
|
-
)
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
def _get_user_dirs_folder(key: str) -> str | None:
|
|
373
|
-
"""Return directory from user-dirs.dirs config file.
|
|
374
|
-
|
|
375
|
-
``xdg-user-dirs-update`` writes shell assignments, so match each line like ``xdg-user-dir`` does and keep the last
|
|
376
|
-
valid assignment to ``key``.
|
|
377
|
-
|
|
378
|
-
See https://freedesktop.org/wiki/Software/xdg-user-dirs/.
|
|
379
|
-
|
|
380
|
-
"""
|
|
381
|
-
config_home = _xdg_dir("XDG_CONFIG_HOME") or _expand_user("~/.config")
|
|
382
|
-
user_dirs_config_path = Path(config_home) / "user-dirs.dirs"
|
|
383
|
-
folder = None
|
|
384
|
-
try:
|
|
385
|
-
# the file holds raw path bytes, and surrogateescape round-trips undecodable ones like os.fsdecode
|
|
386
|
-
with user_dirs_config_path.open(encoding=sys.getfilesystemencoding(), errors="surrogateescape") as stream:
|
|
387
|
-
for line in stream:
|
|
388
|
-
if (entry := _USER_DIRS_LINE.match(line)) and entry["key"] == key:
|
|
389
|
-
folder = _resolve_user_dirs_value(entry) or folder
|
|
390
|
-
except OSError: # a missing or unreadable file leaves the defaults in place
|
|
391
|
-
return None
|
|
392
|
-
return folder
|
|
393
|
-
|
|
390
|
+
Creates the runtime directory before checking it, so another user cannot create it in between.
|
|
394
391
|
|
|
395
|
-
|
|
396
|
-
value = entry["bare"] if entry["quoted"] is None else entry["quoted"]
|
|
397
|
-
if value == "$HOME" or value.startswith("$HOME/"):
|
|
398
|
-
# A home of / would give "//Desktop", which pathlib keeps as a distinct root.
|
|
399
|
-
prefix, value = _expand_user("~").rstrip("/"), value.removeprefix("$HOME")
|
|
400
|
-
elif value.startswith("/"):
|
|
401
|
-
prefix = ""
|
|
402
|
-
else:
|
|
403
|
-
return None
|
|
404
|
-
if entry["quoted"] is not None:
|
|
405
|
-
# xdg-user-dirs-update backslash-escapes $, `, " and \ inside the quotes.
|
|
406
|
-
value = re.sub(r'\\([$`"\\])', r"\1", value)
|
|
407
|
-
return f"{prefix}{value}" or "/"
|
|
392
|
+
:param name: see :meth:`~platformdirs.api.PlatformDirsABC.place_runtime_file`.
|
|
408
393
|
|
|
394
|
+
:returns: the path of ``name`` under the user runtime directory.
|
|
409
395
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
return posixpath.join(gettempdir(), f"runtime-{geteuid()}")
|
|
396
|
+
:raises PermissionError: if the temporary fallback is a symlink, not a directory, owned by another user, or
|
|
397
|
+
missing right after its creation.
|
|
413
398
|
|
|
399
|
+
"""
|
|
414
400
|
|
|
415
|
-
def
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
for base in (_temp_runtime_fallback(), _xdg_dir("XDG_RUNTIME_DIR")):
|
|
419
|
-
if base and path.is_relative_to(base):
|
|
420
|
-
return not _runtime_dir_problem(base, missing_ok=False, check_mode=False)
|
|
421
|
-
return True
|
|
401
|
+
def created(lookup: PlatformDirsABC) -> Path:
|
|
402
|
+
lookup.ensure_exists = True
|
|
403
|
+
return lookup.user_runtime_path
|
|
422
404
|
|
|
405
|
+
return self._place_file(created, name)
|
|
423
406
|
|
|
424
|
-
def
|
|
425
|
-
|
|
407
|
+
def _find_runtime_files(self, name: str | os.PathLike[str]) -> Iterator[Path]:
|
|
408
|
+
return filter(_in_own_runtime_dir, super()._find_runtime_files(name))
|
|
426
409
|
|
|
427
|
-
|
|
428
|
-
|
|
410
|
+
def _xdg_media_dir(self, env_var: str) -> str | None:
|
|
411
|
+
# The XDG_*_DIR variables and user-dirs.dirs belong to the user who started the root process.
|
|
412
|
+
return None if self._use_site else super()._xdg_media_dir(env_var)
|
|
429
413
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
# A trailing / or /. makes lstat follow a final symlink, while Path, which creates the directory, drops it.
|
|
433
|
-
info = os.lstat(str(Path(path)))
|
|
434
|
-
except FileNotFoundError:
|
|
435
|
-
return None if missing_ok else f"{path} is missing"
|
|
436
|
-
except OSError as error:
|
|
437
|
-
return f"{path} cannot be checked: {error.strerror}"
|
|
438
|
-
mode = info.st_mode & 0o777
|
|
439
|
-
checks = (
|
|
440
|
-
(stat.S_ISLNK(info.st_mode), "is a symlink"),
|
|
441
|
-
(not stat.S_ISDIR(info.st_mode), "is not a directory"),
|
|
442
|
-
(info.st_uid != (uid := geteuid()), f"is owned by uid {info.st_uid}, not {uid}"),
|
|
443
|
-
(check_mode and mode != _RUNTIME_DIR_MODE, f"has mode {mode:04o}, not {_RUNTIME_DIR_MODE:04o}"),
|
|
444
|
-
)
|
|
445
|
-
return next((f"{path} {problem}" for failed, problem in checks if failed), None)
|
|
414
|
+
def _user_media_dir(self, key: str, default: str) -> str:
|
|
415
|
+
return expand_user(default) if self._use_site else super()._user_media_dir(key, default)
|
|
446
416
|
|
|
447
417
|
|
|
448
418
|
def _runtime_dir_parent_problem(path: str) -> str | None:
|
|
@@ -461,15 +431,34 @@ def _runtime_dir_parent_problem(path: str) -> str | None:
|
|
|
461
431
|
return None
|
|
462
432
|
|
|
463
433
|
|
|
464
|
-
def
|
|
465
|
-
#
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
434
|
+
def _in_own_runtime_dir(path: Path) -> bool:
|
|
435
|
+
# The lookup let a missing runtime directory pass, so another user may have created it since. The fallback goes
|
|
436
|
+
# first because a rejected XDG_RUNTIME_DIR, such as /tmp, contains it.
|
|
437
|
+
for base in (_temp_runtime_fallback(), xdg_dir("XDG_RUNTIME_DIR")):
|
|
438
|
+
if base and path.is_relative_to(base):
|
|
439
|
+
return not _runtime_dir_problem(base, missing_ok=False, check_mode=False)
|
|
440
|
+
return True
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
_USER_DIRS_LINE: Final[re.Pattern[str]] = re.compile(
|
|
444
|
+
r"""
|
|
445
|
+
[ \t]*(?P<key>\w+)[ \t]*=[ \t]* # KEY=, blanks allowed around the key and after the =
|
|
446
|
+
(?:
|
|
447
|
+
"(?P<quoted>(?:[^"\\]|\\.)*)" # a double-quoted value with backslash escapes, text after it ignored
|
|
448
|
+
|(?P<bare>(?:[^"\s\\]|\\.)(?:[^ \t\n\\]|\\.|\\\Z|[ \t]+(?:[^ \t\n\#\\]|\\.))*) # or an unquoted value;
|
|
449
|
+
# a backslash keeps the next character in the word, one that
|
|
450
|
+
# ends the file stays as the shell keeps it, blanks join it
|
|
451
|
+
# only before a word that starts no comment, and each run is
|
|
452
|
+
# matched once so long runs stay linear
|
|
453
|
+
)
|
|
454
|
+
""",
|
|
455
|
+
re.VERBOSE,
|
|
456
|
+
)
|
|
469
457
|
|
|
470
458
|
|
|
471
|
-
|
|
472
|
-
|
|
459
|
+
_LINE_END_CR: Final[re.Pattern[str]] = re.compile(r"\r(?=\n?\Z)")
|
|
460
|
+
_VALUE_PATTERN: Final[re.Pattern[str]] = re.compile(r'\\([$`"\\])')
|
|
461
|
+
_BARE_VALUE_PATTERN: Final[re.Pattern[str]] = re.compile(r"\\(.)")
|
|
473
462
|
|
|
474
463
|
|
|
475
464
|
__all__ = [
|
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '4.14.
|
|
22
|
-
__version_tuple__ = version_tuple = (4, 14,
|
|
21
|
+
__version__ = version = '4.14.7'
|
|
22
|
+
__version_tuple__ = version_tuple = (4, 14, 7)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|