From abd344cbab00851911c89a5202da1aa601ab47c7 Mon Sep 17 00:00:00 2001 From: Vinay Sajip Date: Tue, 3 Jul 2012 16:33:57 +0100 Subject: Issue 15241: Improved site.py documentation relating to venvs. --- Doc/library/site.rst | 9 +++++++++ Lib/site.py | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Doc/library/site.rst b/Doc/library/site.rst index 071706a..3bf8a99 100644 --- a/Doc/library/site.rst +++ b/Doc/library/site.rst @@ -38,6 +38,15 @@ Unix and Macintosh). For each of the distinct head-tail combinations, it sees if it refers to an existing directory, and if so, adds it to ``sys.path`` and also inspects the newly added path for configuration files. +If a file named "pyvenv.cfg" exists one directory above sys.executable, +sys.prefix and sys.exec_prefix are set to that directory and +it is also checked for site-packages and site-python (sys.base_prefix and +sys.base_exec_prefix will always be the "real" prefixes of the Python +installation). If "pyvenv.cfg" (a bootstrap configuration file) contains +the key "include-system-site-packages" set to anything other than "false" +(case-insensitive), the system-level prefixes will still also be +searched for site-packages; otherwise they won't. + A path configuration file is a file whose name has the form :file:`{name}.pth` and exists in one of the four directories mentioned above; its contents are additional items (one per line) to be added to ``sys.path``. Non-existing items diff --git a/Lib/site.py b/Lib/site.py index a0f98b3..0aaf46b 100644 --- a/Lib/site.py +++ b/Lib/site.py @@ -15,8 +15,8 @@ also inspected for path configuration files. If a file named "pyvenv.cfg" exists one directory above sys.executable, sys.prefix and sys.exec_prefix are set to that directory and -it is also checked for site-packages and site-python (sys.prefix and -sys.exec_prefix will always be the "real" prefixes of the Python +it is also checked for site-packages and site-python (sys.base_prefix and +sys.base_exec_prefix will always be the "real" prefixes of the Python installation). If "pyvenv.cfg" (a bootstrap configuration file) contains the key "include-system-site-packages" set to anything other than "false" (case-insensitive), the system-level prefixes will still also be -- cgit v0.12