MCPcopy Index your code
hub / github.com/python/cpython / main

Function main

Lib/site.py:690–717  ·  view source on GitHub ↗

Add standard site-specific directories to the module search path. This function is called automatically when this module is imported, unless the python interpreter was started with the -S flag.

()

Source from the content-addressed store, hash-verified

688
689
690def main():
691 """Add standard site-specific directories to the module search path.
692
693 This function is called automatically when this module is imported,
694 unless the python interpreter was started with the -S flag.
695 """
696 global ENABLE_USER_SITE
697
698 orig_path = sys.path[:]
699 known_paths = removeduppaths()
700 if orig_path != sys.path:
701 # removeduppaths() might make sys.path absolute.
702 # Fix __file__ of already imported modules too.
703 abs_paths()
704
705 known_paths = venv(known_paths)
706 if ENABLE_USER_SITE is None:
707 ENABLE_USER_SITE = check_enableusersite()
708 known_paths = addusersitepackages(known_paths)
709 known_paths = addsitepackages(known_paths)
710 setquit()
711 setcopyright()
712 sethelper()
713 if not sys.flags.isolated:
714 enablerlcompleter()
715 execsitecustomize()
716 if ENABLE_USER_SITE:
717 execusercustomize()
718
719# Prevent extending of sys.path when python was started with -S and
720# site is imported later.

Callers 1

site.pyFile · 0.70

Calls 12

removeduppathsFunction · 0.85
abs_pathsFunction · 0.85
venvFunction · 0.85
check_enableusersiteFunction · 0.85
addusersitepackagesFunction · 0.85
addsitepackagesFunction · 0.85
setquitFunction · 0.85
setcopyrightFunction · 0.85
sethelperFunction · 0.85
enablerlcompleterFunction · 0.85
execsitecustomizeFunction · 0.85
execusercustomizeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…