PHP 8.2.30
Preview: appdirs.py Size: 1.63 KB
//opt/alt/python312/lib/python3.12/site-packages/pip/_internal/utils/appdirs.py

"""
This code wraps the vendored appdirs module to so the return values are
compatible for the current pip code base.

The intention is to rewrite current usages gradually, keeping the tests pass,
and eventually drop this after all usages are changed.
"""

import os
import sys
from typing import List

from pip._vendor import platformdirs as _appdirs


def user_cache_dir(appname: str) -> str:
    return _appdirs.user_cache_dir(appname, appauthor=False)


def _macos_user_config_dir(appname: str, roaming: bool = True) -> str:
    # Use ~/Application Support/pip, if the directory exists.
    path = _appdirs.user_data_dir(appname, appauthor=False, roaming=roaming)
    if os.path.isdir(path):
        return path

    # Use a Linux-like ~/.config/pip, by default.
    linux_like_path = "~/.config/"
    if appname:
        linux_like_path = os.path.join(linux_like_path, appname)

    return os.path.expanduser(linux_like_path)


def user_config_dir(appname: str, roaming: bool = True) -> str:
    if sys.platform == "darwin":
        return _macos_user_config_dir(appname, roaming)

    return _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming)


# for the discussion regarding site_config_dir locations
# see <https://github.com/pypa/pip/issues/1733>
def site_config_dirs(appname: str) -> List[str]:
    if sys.platform == "darwin":
        return [_appdirs.site_data_dir(appname, appauthor=False, multipath=True)]

    dirval = _appdirs.site_config_dir(appname, appauthor=False, multipath=True)
    if sys.platform == "win32":
        return [dirval]

    # Unix-y system. Look in /etc as well.
    return dirval.split(os.pathsep) + ["/etc"]

Directory Contents

Dirs: 1 × Files: 27

Name Size Perms Modified Actions
- drwxr-xr-x 2026-02-10 08:09:14
Edit Download
1.63 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
1.84 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
5.25 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
242 B lrw-r--r-- 2026-01-08 19:19:46
Edit Download
3.54 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
3.13 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
2.07 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
1.14 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
3.07 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
5.00 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
716 B lrw-r--r-- 2026-01-08 19:19:46
Edit Download
3.04 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
5.00 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
11.33 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
23.18 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
1.17 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
2.06 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
4.33 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
8.99 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
9.09 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
8.61 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
1.72 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
3.38 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
4.44 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
3.27 KB lrw-r--r-- 2026-01-08 19:19:46
Edit Download
1015 B lrw-r--r-- 2026-01-08 19:19:46
Edit Download
0 B lrw-r--r-- 2026-01-08 19:19:46
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).