()
| 112 | # NOTE: site.py has copy of this function. |
| 113 | # Sync it when modify this function. |
| 114 | def _getuserbase(): |
| 115 | env_base = os.environ.get("PYTHONUSERBASE", None) |
| 116 | if env_base: |
| 117 | return env_base |
| 118 | |
| 119 | # Emscripten, iOS, tvOS, VxWorks, WASI, and watchOS have no home directories. |
| 120 | # Use _PYTHON_HOST_PLATFORM to get the correct platform when cross-compiling. |
| 121 | system_name = os.environ.get('_PYTHON_HOST_PLATFORM', sys.platform).split('-')[0] |
| 122 | if system_name in {"emscripten", "ios", "tvos", "vxworks", "wasi", "watchos"}: |
| 123 | return None |
| 124 | |
| 125 | def joinuser(*args): |
| 126 | return os.path.expanduser(os.path.join(*args)) |
| 127 | |
| 128 | if os.name == "nt": |
| 129 | base = os.environ.get("APPDATA") or "~" |
| 130 | return joinuser(base, _get_implementation()) |
| 131 | |
| 132 | if sys.platform == "darwin" and sys._framework: |
| 133 | return joinuser("~", "Library", sys._framework, |
| 134 | f"{sys.version_info[0]}.{sys.version_info[1]}") |
| 135 | |
| 136 | return joinuser("~", ".local") |
| 137 | |
| 138 | _HAS_USER_BASE = (_getuserbase() is not None) |
| 139 |
no test coverage detected
searching dependent graphs…