MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / _getuserbase

Function _getuserbase

tools/python-3.11.9-amd64/Lib/sysconfig.py:109–129  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107# NOTE: site.py has copy of this function.
108# Sync it when modify this function.
109def _getuserbase():
110 env_base = os.environ.get("PYTHONUSERBASE", None)
111 if env_base:
112 return env_base
113
114 # Emscripten, VxWorks, and WASI have no home directories
115 if sys.platform in {"emscripten", "vxworks", "wasi"}:
116 return None
117
118 def joinuser(*args):
119 return os.path.expanduser(os.path.join(*args))
120
121 if os.name == "nt":
122 base = os.environ.get("APPDATA") or "~"
123 return joinuser(base, "Python")
124
125 if sys.platform == "darwin" and sys._framework:
126 return joinuser("~", "Library", sys._framework,
127 f"{sys.version_info[0]}.{sys.version_info[1]}")
128
129 return joinuser("~", ".local")
130
131_HAS_USER_BASE = (_getuserbase() is not None)
132

Callers 2

sysconfig.pyFile · 0.70
get_config_varsFunction · 0.70

Calls 2

joinuserFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected