HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/virtualenv/discovery/info.py
from __future__ import annotations

import logging
import os
import sys
import tempfile

_FS_CASE_SENSITIVE = None
LOGGER = logging.getLogger(__name__)
IS_WIN = sys.platform == "win32"


def fs_is_case_sensitive():
    """Check if the file system is case-sensitive."""
    global _FS_CASE_SENSITIVE  # noqa: PLW0603

    if _FS_CASE_SENSITIVE is None:
        with tempfile.NamedTemporaryFile(prefix="TmP") as tmp_file:
            _FS_CASE_SENSITIVE = not os.path.exists(tmp_file.name.lower())
            LOGGER.debug("filesystem is %scase-sensitive", "" if _FS_CASE_SENSITIVE else "not ")
    return _FS_CASE_SENSITIVE


def fs_path_id(path: str) -> str:
    """Get a case-normalized path identifier."""
    return path.casefold() if fs_is_case_sensitive() else path


__all__ = (
    "IS_WIN",
    "fs_is_case_sensitive",
    "fs_path_id",
)