| Server IP : 198.38.94.67 / Your IP : 216.73.217.74 Web Server : LiteSpeed System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64 User : azfilmst ( 1070) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/saltstack/salt/lib/python3.10/site-packages/python_discovery/ |
Upload File : |
"""Platform compatibility utilities for Python discovery."""
from __future__ import annotations
import functools
import logging
import pathlib
import tempfile
from typing import Final
_LOGGER: Final[logging.Logger] = logging.getLogger(__name__)
@functools.lru_cache(maxsize=1)
def fs_is_case_sensitive() -> bool:
with tempfile.NamedTemporaryFile(prefix="TmP") as tmp_file:
result = not pathlib.Path(tmp_file.name.lower()).exists()
_LOGGER.debug("filesystem is %scase-sensitive", "" if result else "not ")
return result
def fs_path_id(path: str) -> str:
return path.casefold() if not fs_is_case_sensitive() else path
__all__ = [
"fs_is_case_sensitive",
"fs_path_id",
]