MCPcopy Create free account
hub / github.com/RustPython/RustPython / getusersitepackages

Function getusersitepackages

Lib/site.py:353–368  ·  view source on GitHub ↗

Returns the user-specific site-packages directory path. If the global variable ``USER_SITE`` is not initialized yet, this function will also set it.

()

Source from the content-addressed store, hash-verified

351
352
353def getusersitepackages():
354 """Returns the user-specific site-packages directory path.
355
356 If the global variable ``USER_SITE`` is not initialized yet, this
357 function will also set it.
358 """
359 global USER_SITE, ENABLE_USER_SITE
360 userbase = getuserbase() # this will also set USER_BASE
361
362 if USER_SITE is None:
363 if userbase is None:
364 ENABLE_USER_SITE = False # disable user site and return None
365 else:
366 USER_SITE = _get_path(userbase)
367
368 return USER_SITE
369
370def addusersitepackages(known_paths):
371 """Add a per user site-package to sys.path

Callers 2

addusersitepackagesFunction · 0.85
_scriptFunction · 0.85

Calls 2

getuserbaseFunction · 0.85
_get_pathFunction · 0.85

Tested by

no test coverage detected