Esempio n. 1
0
def _infer_user():
    # type: () -> str
    """Try to find a user scheme for the current platform."""
    suffixed = f"{os.name}_user"
    if suffixed in _AVAILABLE_SCHEMES:
        return suffixed
    if "posix_user" not in _AVAILABLE_SCHEMES:  # User scheme unavailable.
        raise UserInstallationInvalid()
    return "posix_user"
Esempio n. 2
0
def _infer_user() -> str:
    """Try to find a user scheme for the current platform."""
    if _HAS_PREFERRED_SCHEME_API:
        return sysconfig.get_preferred_scheme("user")  # type: ignore
    if is_osx_framework() and not running_under_virtualenv():
        suffixed = "osx_framework_user"
    else:
        suffixed = f"{os.name}_user"
    if suffixed in _AVAILABLE_SCHEMES:
        return suffixed
    if "posix_user" not in _AVAILABLE_SCHEMES:  # User scheme unavailable.
        raise UserInstallationInvalid()
    return "posix_user"