summaryrefslogtreecommitdiffstats
path: root/Doc/library/site.rst
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-03-23 01:06:24 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-03-23 01:06:24 (GMT)
commitc09fca67e7babfda22964143c74dcd313470850a (patch)
tree050cead4915139132014dfda4a07c2d0872d314a /Doc/library/site.rst
parentf59c7b2bddbeb552dac8a1fc8c800c7789c81331 (diff)
downloadcpython-c09fca67e7babfda22964143c74dcd313470850a.zip
cpython-c09fca67e7babfda22964143c74dcd313470850a.tar.gz
cpython-c09fca67e7babfda22964143c74dcd313470850a.tar.bz2
Do not touch sys.path when site is imported and python was started with -S.
Original patch by Carl Meyer, review by Brett Cannon, small doc editions by yours truly. Fixes #11591.
Diffstat (limited to 'Doc/library/site.rst')
-rw-r--r--Doc/library/site.rst13
1 files changed, 12 insertions, 1 deletions
diff --git a/Doc/library/site.rst b/Doc/library/site.rst
index b77f3cf..4b7a234 100644
--- a/Doc/library/site.rst
+++ b/Doc/library/site.rst
@@ -13,7 +13,11 @@ import can be suppressed using the interpreter's :option:`-S` option.
.. index:: triple: module; search; path
-Importing this module will append site-specific paths to the module search path.
+Importing this module will append site-specific paths to the module search
+path, unless :option:`-S` was used. In that case, this module can be safely
+imported with no automatic modifications to the module search path. To
+explicitly trigger the usual site-specific additions, call the
+:func:`site.main` function.
.. index::
pair: site-python; directory
@@ -114,6 +118,13 @@ empty, and the path manipulations are skipped; however the import of
.. envvar:: PYTHONUSERBASE
+.. function:: main()
+
+ Adds all the standard site-specific directories to the module search
+ path. This function is called automatically when this module is imported,
+ unless the :program:`python` interpreter was started with the :option:`-S`
+ flag.
+
.. function:: addsitedir(sitedir, known_paths=None)
Adds a directory to sys.path and processes its pth files.